mirror of
				https://github.com/chylex/IntelliJ-IdeaVim.git
				synced 2025-11-04 10:40:10 +01:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			customized
			...
			customized
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						c9eb104a45
	
				 | 
					
					
						|||
| 
						
						
							
						
						ade53624cc
	
				 | 
					
					
						
@@ -11,7 +11,7 @@
 | 
				
			|||||||
ideaVersion=2023.3.2
 | 
					ideaVersion=2023.3.2
 | 
				
			||||||
downloadIdeaSources=true
 | 
					downloadIdeaSources=true
 | 
				
			||||||
instrumentPluginCode=true
 | 
					instrumentPluginCode=true
 | 
				
			||||||
version=chylex-1
 | 
					version=chylex-25
 | 
				
			||||||
javaVersion=17
 | 
					javaVersion=17
 | 
				
			||||||
remoteRobotVersion=0.11.21
 | 
					remoteRobotVersion=0.11.21
 | 
				
			||||||
antlrVersion=4.10.1
 | 
					antlrVersion=4.10.1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,6 +34,7 @@ import com.maddyhome.idea.vim.VimPlugin
 | 
				
			|||||||
import com.maddyhome.idea.vim.action.VimShortcutKeyAction
 | 
					import com.maddyhome.idea.vim.action.VimShortcutKeyAction
 | 
				
			||||||
import com.maddyhome.idea.vim.api.injector
 | 
					import com.maddyhome.idea.vim.api.injector
 | 
				
			||||||
import com.maddyhome.idea.vim.group.NotificationService
 | 
					import com.maddyhome.idea.vim.group.NotificationService
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.helper.EditorHelper
 | 
				
			||||||
import com.maddyhome.idea.vim.helper.isIdeaVimDisabledHere
 | 
					import com.maddyhome.idea.vim.helper.isIdeaVimDisabledHere
 | 
				
			||||||
import com.maddyhome.idea.vim.helper.vimStateMachine
 | 
					import com.maddyhome.idea.vim.helper.vimStateMachine
 | 
				
			||||||
import com.maddyhome.idea.vim.newapi.globalIjOptions
 | 
					import com.maddyhome.idea.vim.newapi.globalIjOptions
 | 
				
			||||||
@@ -95,41 +96,45 @@ internal object IdeaSpecifics {
 | 
				
			|||||||
      if (VimPlugin.isNotEnabled()) return
 | 
					      if (VimPlugin.isNotEnabled()) return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      val editor = editor
 | 
					      val editor = editor
 | 
				
			||||||
      if (editor != null && action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
 | 
					      if (editor != null) {
 | 
				
			||||||
        val prevDocumentLength = completionPrevDocumentLength
 | 
					        if (action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
 | 
				
			||||||
        val prevDocumentOffset = completionPrevDocumentOffset
 | 
					          val prevDocumentLength = completionPrevDocumentLength
 | 
				
			||||||
 | 
					          val prevDocumentOffset = completionPrevDocumentOffset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (prevDocumentLength != null && prevDocumentOffset != null) {
 | 
					          if (prevDocumentLength != null && prevDocumentOffset != null) {
 | 
				
			||||||
          val register = VimPlugin.getRegister()
 | 
					            val register = VimPlugin.getRegister()
 | 
				
			||||||
          val addedTextLength = editor.document.textLength - prevDocumentLength
 | 
					            val addedTextLength = editor.document.textLength - prevDocumentLength
 | 
				
			||||||
          val caretShift = addedTextLength - (editor.caretModel.primaryCaret.offset - prevDocumentOffset)
 | 
					            val caretShift = addedTextLength - (editor.caretModel.primaryCaret.offset - prevDocumentOffset)
 | 
				
			||||||
          val leftArrow = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)
 | 
					            val leftArrow = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          register.recordText(editor.document.getText(TextRange(prevDocumentOffset, prevDocumentOffset + addedTextLength)))
 | 
					            register.recordText(editor.document.getText(TextRange(prevDocumentOffset, prevDocumentOffset + addedTextLength)))
 | 
				
			||||||
          repeat(caretShift.coerceAtLeast(0)) {
 | 
					            repeat(caretShift.coerceAtLeast(0)) {
 | 
				
			||||||
            register.recordKeyStroke(leftArrow)
 | 
					              register.recordKeyStroke(leftArrow)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          this.completionPrevDocumentLength = null
 | 
				
			||||||
 | 
					          this.completionPrevDocumentOffset = null
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        this.completionPrevDocumentLength = null
 | 
					        //region Enter insert mode after surround with if
 | 
				
			||||||
        this.completionPrevDocumentOffset = null
 | 
					        if (surrounderAction == action.javaClass.name && surrounderItems.any {
 | 
				
			||||||
      }
 | 
					            action.templatePresentation.text.endsWith(
 | 
				
			||||||
 | 
					              it,
 | 
				
			||||||
      //region Enter insert mode after surround with if
 | 
					            )
 | 
				
			||||||
      if (surrounderAction == action.javaClass.name && surrounderItems.any {
 | 
					          }
 | 
				
			||||||
          action.templatePresentation.text.endsWith(
 | 
					        ) {
 | 
				
			||||||
            it,
 | 
					          val commandState = editor.vim.vimStateMachine
 | 
				
			||||||
          )
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      ) {
 | 
					 | 
				
			||||||
        editor?.let {
 | 
					 | 
				
			||||||
          val commandState = it.vim.vimStateMachine
 | 
					 | 
				
			||||||
          commandState.mode = Mode.NORMAL()
 | 
					          commandState.mode = Mode.NORMAL()
 | 
				
			||||||
          VimPlugin.getChange().insertBeforeCursor(it.vim, event.dataContext.vim)
 | 
					          VimPlugin.getChange().insertBeforeCursor(editor.vim, event.dataContext.vim)
 | 
				
			||||||
          KeyHandler.getInstance().reset(it.vim)
 | 
					          KeyHandler.getInstance().reset(editor.vim)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        //endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (EditorHelper.getVisibleArea(editor).let { it.width > 0 && it.height > 0 }) {
 | 
				
			||||||
 | 
					          injector.scroll.scrollCaretIntoView(editor.vim)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      //endregion
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.editor = null
 | 
					      this.editor = null
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user