mirror of
				https://github.com/chylex/IntelliJ-IdeaVim.git
				synced 2025-11-04 10:40:10 +01:00 
			
		
		
		
	Compare commits
	
		
			15 Commits
		
	
	
		
			8bcb0d116d
			...
			customized
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						4ca05ba6df
	
				 | 
					
					
						|||
| 
						
						
							
						
						114ac40990
	
				 | 
					
					
						|||
| 
						
						
							
						
						2829109eb7
	
				 | 
					
					
						|||
| 
						
						
							
						
						f1323139b4
	
				 | 
					
					
						|||
| 
						
						
							
						
						df4aa59310
	
				 | 
					
					
						|||
| 
						
						
							
						
						7a3bb5b2d7
	
				 | 
					
					
						|||
| 
						
						
							
						
						c4b05957fc
	
				 | 
					
					
						|||
| 
						
						
							
						
						db83b89931
	
				 | 
					
					
						|||
| 
						
						
							
						
						ce27c3e5ba
	
				 | 
					
					
						|||
| 
						
						
							
						
						31358bc983
	
				 | 
					
					
						|||
| 
						
						
							
						
						f7e1c9c837
	
				 | 
					
					
						|||
| 
						
						
							
						
						c46109caa3
	
				 | 
					
					
						|||
| 
						
						
							
						
						9f7ca83306
	
				 | 
					
					
						|||
| 
						
						
							
						
						b5761f20d2
	
				 | 
					
					
						|||
| 
						
						
							
						
						305c6d2bf9
	
				 | 
					
					
						
@@ -8,10 +8,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# suppress inspection "UnusedProperty" for whole file
 | 
					# suppress inspection "UnusedProperty" for whole file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ideaVersion=2023.2.1
 | 
					ideaVersion=2023.2
 | 
				
			||||||
downloadIdeaSources=true
 | 
					downloadIdeaSources=true
 | 
				
			||||||
instrumentPluginCode=true
 | 
					instrumentPluginCode=true
 | 
				
			||||||
version=chylex-16
 | 
					version=chylex-19
 | 
				
			||||||
javaVersion=17
 | 
					javaVersion=17
 | 
				
			||||||
remoteRobotVersion=0.11.17
 | 
					remoteRobotVersion=0.11.17
 | 
				
			||||||
antlrVersion=4.10.1
 | 
					antlrVersion=4.10.1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,10 +14,14 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread
 | 
				
			|||||||
import com.intellij.openapi.actionSystem.AnAction
 | 
					import com.intellij.openapi.actionSystem.AnAction
 | 
				
			||||||
import com.intellij.openapi.actionSystem.AnActionEvent
 | 
					import com.intellij.openapi.actionSystem.AnActionEvent
 | 
				
			||||||
import com.intellij.openapi.actionSystem.AnActionWrapper
 | 
					import com.intellij.openapi.actionSystem.AnActionWrapper
 | 
				
			||||||
 | 
					import com.intellij.openapi.actionSystem.IdeActions
 | 
				
			||||||
 | 
					import com.intellij.openapi.actionSystem.KeyboardShortcut
 | 
				
			||||||
import com.intellij.openapi.actionSystem.PlatformDataKeys
 | 
					import com.intellij.openapi.actionSystem.PlatformDataKeys
 | 
				
			||||||
import com.intellij.openapi.application.invokeLater
 | 
					import com.intellij.openapi.application.invokeLater
 | 
				
			||||||
import com.intellij.openapi.diagnostic.logger
 | 
					import com.intellij.openapi.diagnostic.logger
 | 
				
			||||||
import com.intellij.openapi.editor.Editor
 | 
					import com.intellij.openapi.editor.Editor
 | 
				
			||||||
 | 
					import com.intellij.openapi.editor.actionSystem.EditorActionManager
 | 
				
			||||||
 | 
					import com.intellij.openapi.keymap.KeymapManager
 | 
				
			||||||
import com.intellij.openapi.progress.ProcessCanceledException
 | 
					import com.intellij.openapi.progress.ProcessCanceledException
 | 
				
			||||||
import com.intellij.openapi.project.DumbAware
 | 
					import com.intellij.openapi.project.DumbAware
 | 
				
			||||||
import com.intellij.openapi.util.Key
 | 
					import com.intellij.openapi.util.Key
 | 
				
			||||||
@@ -159,11 +163,15 @@ internal class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatib
 | 
				
			|||||||
      if ((keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ENTER) && editor.appCodeTemplateCaptured()) {
 | 
					      if ((keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ENTER) && editor.appCodeTemplateCaptured()) {
 | 
				
			||||||
        return ActionEnableStatus.no("App code template is active", LogLevel.INFO)
 | 
					        return ActionEnableStatus.no("App code template is active", LogLevel.INFO)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      
 | 
					 | 
				
			||||||
      if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT || keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_HOME || keyCode == KeyEvent.VK_END) {
 | 
					 | 
				
			||||||
        return ActionEnableStatus.no("Special keys", LogLevel.INFO)
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      val nextTemplateVariableShortcuts = KeymapManager.getInstance().activeKeymap.getShortcuts(IdeActions.ACTION_EDITOR_NEXT_TEMPLATE_VARIABLE)
 | 
				
			||||||
 | 
					      if (nextTemplateVariableShortcuts.any { it is KeyboardShortcut && it.firstKeyStroke == keyStroke }) {
 | 
				
			||||||
 | 
					        val handler = EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_NEXT_TEMPLATE_VARIABLE)
 | 
				
			||||||
 | 
					        if (handler.isEnabled(editor, null, e.dataContext)) {
 | 
				
			||||||
 | 
					          return ActionEnableStatus.no("Next template variable or finish in-place refactoring", LogLevel.INFO)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
      if (editor.inInsertMode) {
 | 
					      if (editor.inInsertMode) {
 | 
				
			||||||
        if (keyCode == KeyEvent.VK_TAB) {
 | 
					        if (keyCode == KeyEvent.VK_TAB) {
 | 
				
			||||||
          // TODO: This stops VimEditorTab seeing <Tab> in insert mode and correctly scrolling the view
 | 
					          // TODO: This stops VimEditorTab seeing <Tab> in insert mode and correctly scrolling the view
 | 
				
			||||||
@@ -382,4 +390,4 @@ private class ActionEnableStatus(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
private enum class LogLevel {
 | 
					private enum class LogLevel {
 | 
				
			||||||
  DEBUG, INFO,
 | 
					  DEBUG, INFO,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					package com.maddyhome.idea.vim.extension.surround
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.intellij.util.text.CharSequenceSubSequence
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					internal data class RepeatedCharSequence(val text: CharSequence, val count: Int) : CharSequence {
 | 
				
			||||||
 | 
					  override val length = text.length * count
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  override fun get(index: Int): Char {
 | 
				
			||||||
 | 
					    if (index < 0 || index >= length) throw IndexOutOfBoundsException()
 | 
				
			||||||
 | 
					    return text[index % text.length]
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  override fun subSequence(startIndex: Int, endIndex: Int): CharSequence {
 | 
				
			||||||
 | 
					    return CharSequenceSubSequence(this, startIndex, endIndex)
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  override fun toString(): String {
 | 
				
			||||||
 | 
					    return text.repeat(count)
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  companion object {
 | 
				
			||||||
 | 
					    fun of(text: CharSequence, count: Int): CharSequence {
 | 
				
			||||||
 | 
					      return when (count) {
 | 
				
			||||||
 | 
					        0 -> ""
 | 
				
			||||||
 | 
					        1 -> text
 | 
				
			||||||
 | 
					        else -> RepeatedCharSequence(text, count)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -19,10 +19,7 @@ import com.maddyhome.idea.vim.api.getLeadingCharacterOffset
 | 
				
			|||||||
import com.maddyhome.idea.vim.api.injector
 | 
					import com.maddyhome.idea.vim.api.injector
 | 
				
			||||||
import com.maddyhome.idea.vim.api.setChangeMarks
 | 
					import com.maddyhome.idea.vim.api.setChangeMarks
 | 
				
			||||||
import com.maddyhome.idea.vim.command.MappingMode
 | 
					import com.maddyhome.idea.vim.command.MappingMode
 | 
				
			||||||
import com.maddyhome.idea.vim.state.mode.Mode
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.command.OperatorArguments
 | 
					import com.maddyhome.idea.vim.command.OperatorArguments
 | 
				
			||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.state.mode.selectionType
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.common.TextRange
 | 
					import com.maddyhome.idea.vim.common.TextRange
 | 
				
			||||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
 | 
					import com.maddyhome.idea.vim.extension.ExtensionHandler
 | 
				
			||||||
import com.maddyhome.idea.vim.extension.VimExtension
 | 
					import com.maddyhome.idea.vim.extension.VimExtension
 | 
				
			||||||
@@ -34,7 +31,6 @@ import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMa
 | 
				
			|||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
 | 
					import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
 | 
				
			||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
 | 
					import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
 | 
				
			||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegisterForCaret
 | 
					import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegisterForCaret
 | 
				
			||||||
import com.maddyhome.idea.vim.state.mode.mode
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.helper.runWithEveryCaretAndRestore
 | 
					import com.maddyhome.idea.vim.helper.runWithEveryCaretAndRestore
 | 
				
			||||||
import com.maddyhome.idea.vim.key.OperatorFunction
 | 
					import com.maddyhome.idea.vim.key.OperatorFunction
 | 
				
			||||||
import com.maddyhome.idea.vim.newapi.IjVimCaret
 | 
					import com.maddyhome.idea.vim.newapi.IjVimCaret
 | 
				
			||||||
@@ -43,6 +39,10 @@ import com.maddyhome.idea.vim.newapi.ij
 | 
				
			|||||||
import com.maddyhome.idea.vim.newapi.vim
 | 
					import com.maddyhome.idea.vim.newapi.vim
 | 
				
			||||||
import com.maddyhome.idea.vim.options.helpers.ClipboardOptionHelper
 | 
					import com.maddyhome.idea.vim.options.helpers.ClipboardOptionHelper
 | 
				
			||||||
import com.maddyhome.idea.vim.put.PutData
 | 
					import com.maddyhome.idea.vim.put.PutData
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.state.mode.Mode
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.state.mode.SelectionType
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.state.mode.mode
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.state.mode.selectionType
 | 
				
			||||||
import org.jetbrains.annotations.NonNls
 | 
					import org.jetbrains.annotations.NonNls
 | 
				
			||||||
import java.awt.event.KeyEvent
 | 
					import java.awt.event.KeyEvent
 | 
				
			||||||
import javax.swing.KeyStroke
 | 
					import javax.swing.KeyStroke
 | 
				
			||||||
@@ -83,7 +83,7 @@ internal class VimSurroundExtension : VimExtension {
 | 
				
			|||||||
    override val isRepeatable = true
 | 
					    override val isRepeatable = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
 | 
					    override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
 | 
				
			||||||
      setOperatorFunction(Operator(supportsMultipleCursors = false)) // TODO
 | 
					      setOperatorFunction(Operator(supportsMultipleCursors = false, count = 1)) // TODO
 | 
				
			||||||
      executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
 | 
					      executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -104,7 +104,7 @@ internal class VimSurroundExtension : VimExtension {
 | 
				
			|||||||
        val lastNonWhiteSpaceOffset = getLastNonWhitespaceCharacterOffset(editor.text(), lineStartOffset, lineEndOffset)
 | 
					        val lastNonWhiteSpaceOffset = getLastNonWhitespaceCharacterOffset(editor.text(), lineStartOffset, lineEndOffset)
 | 
				
			||||||
        if (lastNonWhiteSpaceOffset != null) {
 | 
					        if (lastNonWhiteSpaceOffset != null) {
 | 
				
			||||||
          val range = TextRange(lineStartOffset, lastNonWhiteSpaceOffset + 1)
 | 
					          val range = TextRange(lineStartOffset, lastNonWhiteSpaceOffset + 1)
 | 
				
			||||||
          performSurround(pair, range, it)
 | 
					          performSurround(pair, range, it, count = operatorArguments.count1)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
//        it.moveToOffset(lineStartOffset)
 | 
					//        it.moveToOffset(lineStartOffset)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@@ -125,7 +125,7 @@ internal class VimSurroundExtension : VimExtension {
 | 
				
			|||||||
  private class VSurroundHandler : ExtensionHandler {
 | 
					  private class VSurroundHandler : ExtensionHandler {
 | 
				
			||||||
    override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
 | 
					    override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
 | 
				
			||||||
      // NB: Operator ignores SelectionType anyway
 | 
					      // NB: Operator ignores SelectionType anyway
 | 
				
			||||||
      if (!Operator(supportsMultipleCursors = true).apply(editor, context, editor.mode.selectionType)) {
 | 
					      if (!Operator(supportsMultipleCursors = true, count = operatorArguments.count1).apply(editor, context, editor.mode.selectionType)) {
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      runWriteAction {
 | 
					      runWriteAction {
 | 
				
			||||||
@@ -261,7 +261,7 @@ internal class VimSurroundExtension : VimExtension {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private class Operator(private val supportsMultipleCursors: Boolean) : OperatorFunction {
 | 
					  private class Operator(private val supportsMultipleCursors: Boolean, private val count: Int) : OperatorFunction {
 | 
				
			||||||
    override fun apply(vimEditor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
 | 
					    override fun apply(vimEditor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
 | 
				
			||||||
      val editor = vimEditor.ij
 | 
					      val editor = vimEditor.ij
 | 
				
			||||||
      val c = getChar(editor)
 | 
					      val c = getChar(editor)
 | 
				
			||||||
@@ -273,11 +273,11 @@ internal class VimSurroundExtension : VimExtension {
 | 
				
			|||||||
        val change = VimPlugin.getChange()
 | 
					        val change = VimPlugin.getChange()
 | 
				
			||||||
        if (supportsMultipleCursors) {
 | 
					        if (supportsMultipleCursors) {
 | 
				
			||||||
          editor.runWithEveryCaretAndRestore {
 | 
					          editor.runWithEveryCaretAndRestore {
 | 
				
			||||||
            applyOnce(editor, change, pair)
 | 
					            applyOnce(editor, change, pair, count)
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
          applyOnce(editor, change, pair)
 | 
					          applyOnce(editor, change, pair, count)
 | 
				
			||||||
          // Jump back to start
 | 
					          // Jump back to start
 | 
				
			||||||
          executeNormalWithoutMapping(injector.parser.parseKeys("`["), editor)
 | 
					          executeNormalWithoutMapping(injector.parser.parseKeys("`["), editor)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -285,18 +285,15 @@ internal class VimSurroundExtension : VimExtension {
 | 
				
			|||||||
      return true
 | 
					      return true
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    private fun applyOnce(editor: Editor, change: VimChangeGroup, pair: Pair<String, String>) {
 | 
					    private fun applyOnce(editor: Editor, change: VimChangeGroup, pair: Pair<String, String>, count: Int) {
 | 
				
			||||||
      // XXX: Will it work with line-wise or block-wise selections?
 | 
					      // XXX: Will it work with line-wise or block-wise selections?
 | 
				
			||||||
      val primaryCaret = editor.caretModel.primaryCaret
 | 
					      val primaryCaret = editor.caretModel.primaryCaret
 | 
				
			||||||
      val range = getSurroundRange(primaryCaret.vim)
 | 
					      val range = getSurroundRange(primaryCaret.vim)
 | 
				
			||||||
      if (range != null) {
 | 
					      if (range != null) {
 | 
				
			||||||
        change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.startOffset, pair.first)
 | 
					        val start = RepeatedCharSequence.of(pair.first, count)
 | 
				
			||||||
        change.insertText(
 | 
					        val end = RepeatedCharSequence.of(pair.second, count)
 | 
				
			||||||
          IjVimEditor(editor),
 | 
					        change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.startOffset, start)
 | 
				
			||||||
          IjVimCaret(primaryCaret),
 | 
					        change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.endOffset + start.length, end)
 | 
				
			||||||
          range.endOffset + pair.first.length,
 | 
					 | 
				
			||||||
          pair.second
 | 
					 | 
				
			||||||
        )
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -378,15 +375,15 @@ internal class VimSurroundExtension : VimExtension {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private fun performSurround(pair: Pair<String, String>, range: TextRange, caret: VimCaret, tagsOnNewLines: Boolean = false) {
 | 
					    private fun performSurround(pair: Pair<String, String>, range: TextRange, caret: VimCaret, count: Int, tagsOnNewLines: Boolean = false) {
 | 
				
			||||||
      runWriteAction {
 | 
					      runWriteAction {
 | 
				
			||||||
        val editor = caret.editor
 | 
					        val editor = caret.editor
 | 
				
			||||||
        val change = VimPlugin.getChange()
 | 
					        val change = VimPlugin.getChange()
 | 
				
			||||||
        val leftSurround = pair.first + if (tagsOnNewLines) "\n" else ""
 | 
					        val leftSurround = RepeatedCharSequence.of(pair.first + if (tagsOnNewLines) "\n" else "", count)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        val isEOF = range.endOffset == editor.text().length
 | 
					        val isEOF = range.endOffset == editor.text().length
 | 
				
			||||||
        val hasNewLine = editor.endsWithNewLine()
 | 
					        val hasNewLine = editor.endsWithNewLine()
 | 
				
			||||||
        val rightSurround = if (tagsOnNewLines) {
 | 
					        val rightSurround = (if (tagsOnNewLines) {
 | 
				
			||||||
          if (isEOF && !hasNewLine) {
 | 
					          if (isEOF && !hasNewLine) {
 | 
				
			||||||
            "\n" + pair.second
 | 
					            "\n" + pair.second
 | 
				
			||||||
          } else {
 | 
					          } else {
 | 
				
			||||||
@@ -394,7 +391,7 @@ internal class VimSurroundExtension : VimExtension {
 | 
				
			|||||||
          }
 | 
					          }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          pair.second
 | 
					          pair.second
 | 
				
			||||||
        }
 | 
					        }).let { RepeatedCharSequence.of(it, count) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        change.insertText(editor, caret, range.startOffset, leftSurround)
 | 
					        change.insertText(editor, caret, range.startOffset, leftSurround)
 | 
				
			||||||
        change.insertText(editor, caret, range.endOffset + leftSurround.length, rightSurround)
 | 
					        change.insertText(editor, caret, range.endOffset + leftSurround.length, rightSurround)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -335,7 +335,7 @@ public class EditorHelper {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    final int offset = y - ((screenHeight - lineHeight) / lineHeight / 2 * lineHeight);
 | 
					    final int offset = y - ((screenHeight - lineHeight) / lineHeight / 2 * lineHeight);
 | 
				
			||||||
    @NotNull final VimEditor editor1 = new IjVimEditor(editor);
 | 
					    @NotNull final VimEditor editor1 = new IjVimEditor(editor);
 | 
				
			||||||
    final int lastVisualLine = EngineEditorHelperKt.getVisualLineCount(editor1) - 1;
 | 
					    final int lastVisualLine = EngineEditorHelperKt.getVisualLineCount(editor1) + editor.getSettings().getAdditionalLinesCount();
 | 
				
			||||||
    final int offsetForLastLineAtBottom = getOffsetToScrollVisualLineToBottomOfScreen(editor, lastVisualLine);
 | 
					    final int offsetForLastLineAtBottom = getOffsetToScrollVisualLineToBottomOfScreen(editor, lastVisualLine);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // For `zz`, we want to use virtual space and move any line, including the last one, to the middle of the screen.
 | 
					    // For `zz`, we want to use virtual space and move any line, including the last one, to the middle of the screen.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,6 @@ import com.maddyhome.idea.vim.api.injector
 | 
				
			|||||||
import com.maddyhome.idea.vim.api.normalizeVisualColumn
 | 
					import com.maddyhome.idea.vim.api.normalizeVisualColumn
 | 
				
			||||||
import com.maddyhome.idea.vim.api.options
 | 
					import com.maddyhome.idea.vim.api.options
 | 
				
			||||||
import com.maddyhome.idea.vim.command.CommandFlags
 | 
					import com.maddyhome.idea.vim.command.CommandFlags
 | 
				
			||||||
import com.maddyhome.idea.vim.state.VimStateMachine
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.helper.EditorHelper.getApproximateScreenHeight
 | 
					import com.maddyhome.idea.vim.helper.EditorHelper.getApproximateScreenHeight
 | 
				
			||||||
import com.maddyhome.idea.vim.helper.EditorHelper.getApproximateScreenWidth
 | 
					import com.maddyhome.idea.vim.helper.EditorHelper.getApproximateScreenWidth
 | 
				
			||||||
import com.maddyhome.idea.vim.helper.EditorHelper.getNonNormalizedVisualLineAtBottomOfScreen
 | 
					import com.maddyhome.idea.vim.helper.EditorHelper.getNonNormalizedVisualLineAtBottomOfScreen
 | 
				
			||||||
@@ -29,6 +28,7 @@ import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToBottomOfScre
 | 
				
			|||||||
import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToMiddleOfScreen
 | 
					import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToMiddleOfScreen
 | 
				
			||||||
import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToTopOfScreen
 | 
					import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToTopOfScreen
 | 
				
			||||||
import com.maddyhome.idea.vim.newapi.vim
 | 
					import com.maddyhome.idea.vim.newapi.vim
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.state.VimStateMachine
 | 
				
			||||||
import kotlin.math.max
 | 
					import kotlin.math.max
 | 
				
			||||||
import kotlin.math.min
 | 
					import kotlin.math.min
 | 
				
			||||||
import kotlin.math.roundToInt
 | 
					import kotlin.math.roundToInt
 | 
				
			||||||
@@ -56,7 +56,7 @@ internal object ScrollViewHelper {
 | 
				
			|||||||
    // that this needs to be replaced as a more or less dumb line for line rewrite.
 | 
					    // that this needs to be replaced as a more or less dumb line for line rewrite.
 | 
				
			||||||
    val topLine = getVisualLineAtTopOfScreen(editor)
 | 
					    val topLine = getVisualLineAtTopOfScreen(editor)
 | 
				
			||||||
    val bottomLine = getVisualLineAtBottomOfScreen(editor)
 | 
					    val bottomLine = getVisualLineAtBottomOfScreen(editor)
 | 
				
			||||||
    val lastLine = vimEditor.getVisualLineCount() - 1
 | 
					    val lastLine = vimEditor.getVisualLineCount() + editor.settings.additionalLinesCount
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // We need the non-normalised value here, so we can handle cases such as so=999 to keep the current line centred
 | 
					    // We need the non-normalised value here, so we can handle cases such as so=999 to keep the current line centred
 | 
				
			||||||
    val scrollOffset = injector.options(vimEditor).scrolloff
 | 
					    val scrollOffset = injector.options(vimEditor).scrolloff
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,6 +88,8 @@ import com.maddyhome.idea.vim.listener.MouseEventsDataHolder.skipNDragEvents
 | 
				
			|||||||
import com.maddyhome.idea.vim.listener.VimListenerManager.EditorListeners.add
 | 
					import com.maddyhome.idea.vim.listener.VimListenerManager.EditorListeners.add
 | 
				
			||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
 | 
					import com.maddyhome.idea.vim.newapi.IjVimEditor
 | 
				
			||||||
import com.maddyhome.idea.vim.newapi.vim
 | 
					import com.maddyhome.idea.vim.newapi.vim
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.state.VimStateMachine
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.state.mode.Mode
 | 
				
			||||||
import com.maddyhome.idea.vim.state.mode.inSelectMode
 | 
					import com.maddyhome.idea.vim.state.mode.inSelectMode
 | 
				
			||||||
import com.maddyhome.idea.vim.state.mode.mode
 | 
					import com.maddyhome.idea.vim.state.mode.mode
 | 
				
			||||||
import com.maddyhome.idea.vim.state.mode.selectionType
 | 
					import com.maddyhome.idea.vim.state.mode.selectionType
 | 
				
			||||||
@@ -265,6 +267,16 @@ internal object VimListenerManager {
 | 
				
			|||||||
  class VimFileEditorManagerListener : FileEditorManagerListener {
 | 
					  class VimFileEditorManagerListener : FileEditorManagerListener {
 | 
				
			||||||
    override fun selectionChanged(event: FileEditorManagerEvent) {
 | 
					    override fun selectionChanged(event: FileEditorManagerEvent) {
 | 
				
			||||||
      if (!VimPlugin.isEnabled()) return
 | 
					      if (!VimPlugin.isEnabled()) return
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      val newEditor = event.newEditor
 | 
				
			||||||
 | 
					      if (newEditor is TextEditor) {
 | 
				
			||||||
 | 
					        val editor = newEditor.editor
 | 
				
			||||||
 | 
					        if (editor.isInsertMode) {
 | 
				
			||||||
 | 
					          VimStateMachine.getInstance(editor).mode = Mode.NORMAL()
 | 
				
			||||||
 | 
					          KeyHandler.getInstance().reset(editor.vim)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
      MotionGroup.fileEditorManagerSelectionChangedCallback(event)
 | 
					      MotionGroup.fileEditorManagerSelectionChangedCallback(event)
 | 
				
			||||||
      FileGroup.fileEditorManagerSelectionChangedCallback(event)
 | 
					      FileGroup.fileEditorManagerSelectionChangedCallback(event)
 | 
				
			||||||
      SearchGroup.fileEditorManagerSelectionChangedCallback(event)
 | 
					      SearchGroup.fileEditorManagerSelectionChangedCallback(event)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,12 +18,12 @@ import com.intellij.openapi.diagnostic.logger
 | 
				
			|||||||
import com.intellij.openapi.editor.Document
 | 
					import com.intellij.openapi.editor.Document
 | 
				
			||||||
import com.intellij.openapi.editor.toolbar.floating.AbstractFloatingToolbarProvider
 | 
					import com.intellij.openapi.editor.toolbar.floating.AbstractFloatingToolbarProvider
 | 
				
			||||||
import com.intellij.openapi.editor.toolbar.floating.FloatingToolbarComponent
 | 
					import com.intellij.openapi.editor.toolbar.floating.FloatingToolbarComponent
 | 
				
			||||||
import com.intellij.openapi.fileEditor.FileDocumentManager
 | 
					 | 
				
			||||||
import com.intellij.openapi.project.DumbAwareAction
 | 
					import com.intellij.openapi.project.DumbAwareAction
 | 
				
			||||||
import com.intellij.openapi.util.Disposer
 | 
					import com.intellij.openapi.util.Disposer
 | 
				
			||||||
import com.intellij.openapi.util.io.FileUtil
 | 
					import com.intellij.openapi.util.io.FileUtil
 | 
				
			||||||
import com.maddyhome.idea.vim.api.VimrcFileState
 | 
					import com.maddyhome.idea.vim.api.VimrcFileState
 | 
				
			||||||
import com.maddyhome.idea.vim.api.injector
 | 
					import com.maddyhome.idea.vim.api.injector
 | 
				
			||||||
 | 
					import com.maddyhome.idea.vim.extension.VimExtensionRegistrar
 | 
				
			||||||
import com.maddyhome.idea.vim.helper.MessageHelper
 | 
					import com.maddyhome.idea.vim.helper.MessageHelper
 | 
				
			||||||
import com.maddyhome.idea.vim.icons.VimIcons
 | 
					import com.maddyhome.idea.vim.icons.VimIcons
 | 
				
			||||||
import com.maddyhome.idea.vim.key.MappingOwner
 | 
					import com.maddyhome.idea.vim.key.MappingOwner
 | 
				
			||||||
@@ -149,12 +149,14 @@ internal class ReloadVimRc : DumbAwareAction() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  override fun actionPerformed(e: AnActionEvent) {
 | 
					  override fun actionPerformed(e: AnActionEvent) {
 | 
				
			||||||
    val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
 | 
					    val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
 | 
				
			||||||
    FileDocumentManager.getInstance().saveDocumentAsIs(editor.document)
 | 
					 | 
				
			||||||
    injector.keyGroup.removeKeyMapping(MappingOwner.IdeaVim.InitScript)
 | 
					    injector.keyGroup.removeKeyMapping(MappingOwner.IdeaVim.InitScript)
 | 
				
			||||||
    Troubleshooter.instance.removeByType("old-action-notation-in-mappings")
 | 
					    Troubleshooter.instance.removeByType("old-action-notation-in-mappings")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Reload the ideavimrc in the context of the current window, as though we had called `:source ~/.ideavimrc`
 | 
					    // Reload the ideavimrc in the context of the current window, as though we had called `:source ~/.ideavimrc`
 | 
				
			||||||
    executeIdeaVimRc(editor.vim)
 | 
					    executeIdeaVimRc(editor.vim)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Ensure newly added extensions are initialized
 | 
				
			||||||
 | 
					    VimExtensionRegistrar.enableDelayedExtensions()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,8 @@ package com.maddyhome.idea.vim.vimscript
 | 
				
			|||||||
import com.intellij.openapi.actionSystem.DataContext
 | 
					import com.intellij.openapi.actionSystem.DataContext
 | 
				
			||||||
import com.intellij.openapi.components.Service
 | 
					import com.intellij.openapi.components.Service
 | 
				
			||||||
import com.intellij.openapi.diagnostic.logger
 | 
					import com.intellij.openapi.diagnostic.logger
 | 
				
			||||||
 | 
					import com.intellij.openapi.fileEditor.FileDocumentManager
 | 
				
			||||||
 | 
					import com.intellij.openapi.vfs.VirtualFileManager
 | 
				
			||||||
import com.maddyhome.idea.vim.VimPlugin
 | 
					import com.maddyhome.idea.vim.VimPlugin
 | 
				
			||||||
import com.maddyhome.idea.vim.api.ExecutionContext
 | 
					import com.maddyhome.idea.vim.api.ExecutionContext
 | 
				
			||||||
import com.maddyhome.idea.vim.api.VimEditor
 | 
					import com.maddyhome.idea.vim.api.VimEditor
 | 
				
			||||||
@@ -88,12 +90,22 @@ internal class Executor : VimScriptExecutorBase() {
 | 
				
			|||||||
  override fun executeFile(file: File, editor: VimEditor, indicateErrors: Boolean) {
 | 
					  override fun executeFile(file: File, editor: VimEditor, indicateErrors: Boolean) {
 | 
				
			||||||
    val context = DataContext.EMPTY_CONTEXT.vim
 | 
					    val context = DataContext.EMPTY_CONTEXT.vim
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
 | 
					      ensureFileIsSaved(file)
 | 
				
			||||||
      execute(file.readText(), editor, context, skipHistory = true, indicateErrors)
 | 
					      execute(file.readText(), editor, context, skipHistory = true, indicateErrors)
 | 
				
			||||||
    } catch (ignored: IOException) {
 | 
					    } catch (ignored: IOException) {
 | 
				
			||||||
      LOG.error(ignored)
 | 
					      LOG.error(ignored)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  private fun ensureFileIsSaved(file: File) {
 | 
				
			||||||
 | 
					    val documentManager = FileDocumentManager.getInstance()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    VirtualFileManager.getInstance().findFileByNioPath(file.toPath())
 | 
				
			||||||
 | 
					      ?.let(documentManager::getCachedDocument)
 | 
				
			||||||
 | 
					      ?.takeIf(documentManager::isDocumentUnsaved)
 | 
				
			||||||
 | 
					      ?.let(documentManager::saveDocumentAsIs)
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Throws(ExException::class)
 | 
					  @Throws(ExException::class)
 | 
				
			||||||
  override fun executeLastCommand(editor: VimEditor, context: ExecutionContext): Boolean {
 | 
					  override fun executeLastCommand(editor: VimEditor, context: ExecutionContext): Boolean {
 | 
				
			||||||
    val reg = VimPlugin.getRegister().getRegister(':') ?: return false
 | 
					    val reg = VimPlugin.getRegister().getRegister(':') ?: return false
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package com.maddyhome.idea.vim.vimscript.model.functions.handlers
 | 
					package com.maddyhome.idea.vim.vimscript.model.functions.handlers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.intellij.openapi.util.SystemInfoRt
 | 
				
			||||||
 | 
					import com.intellij.util.system.CpuArch
 | 
				
			||||||
import com.intellij.vim.annotations.VimscriptFunction
 | 
					import com.intellij.vim.annotations.VimscriptFunction
 | 
				
			||||||
import com.maddyhome.idea.vim.api.ExecutionContext
 | 
					import com.maddyhome.idea.vim.api.ExecutionContext
 | 
				
			||||||
import com.maddyhome.idea.vim.api.VimEditor
 | 
					import com.maddyhome.idea.vim.api.VimEditor
 | 
				
			||||||
@@ -23,7 +25,7 @@ internal class HasFunctionHandler : FunctionHandler() {
 | 
				
			|||||||
  override val minimumNumberOfArguments = 1
 | 
					  override val minimumNumberOfArguments = 1
 | 
				
			||||||
  override val maximumNumberOfArguments = 2
 | 
					  override val maximumNumberOfArguments = 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private val supportedFeatures = setOf("ide")
 | 
					  private val supportedFeatures = Features.discover()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  override fun doFunction(
 | 
					  override fun doFunction(
 | 
				
			||||||
    argumentValues: List<Expression>,
 | 
					    argumentValues: List<Expression>,
 | 
				
			||||||
@@ -41,4 +43,40 @@ internal class HasFunctionHandler : FunctionHandler() {
 | 
				
			|||||||
      VimInt.ZERO
 | 
					      VimInt.ZERO
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  private object Features {
 | 
				
			||||||
 | 
					    fun discover(): Set<String> {
 | 
				
			||||||
 | 
					      val features = mutableSetOf("ide")
 | 
				
			||||||
 | 
					      collectOperatingSystemType(features)
 | 
				
			||||||
 | 
					      return features
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    private fun collectOperatingSystemType(target: MutableSet<String>) {
 | 
				
			||||||
 | 
					      if (SystemInfoRt.isWindows) {
 | 
				
			||||||
 | 
					        target.add("win32")
 | 
				
			||||||
 | 
					        if (CpuArch.CURRENT.width == 64) {
 | 
				
			||||||
 | 
					          target.add("win64")
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      else if (SystemInfoRt.isLinux) {
 | 
				
			||||||
 | 
					        target.add("linux")
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      else if (SystemInfoRt.isMac) {
 | 
				
			||||||
 | 
					        target.add("mac")
 | 
				
			||||||
 | 
					        target.add("macunix")
 | 
				
			||||||
 | 
					        target.add("osx")
 | 
				
			||||||
 | 
					        target.add("osxdarwin")
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      else if (SystemInfoRt.isFreeBSD) {
 | 
				
			||||||
 | 
					        target.add("bsd")
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      else if (SystemInfoRt.isSolaris) {
 | 
				
			||||||
 | 
					        target.add("sun")
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      if (SystemInfoRt.isUnix) {
 | 
				
			||||||
 | 
					        target.add("unix")
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,49 +0,0 @@
 | 
				
			|||||||
/*
 | 
					 | 
				
			||||||
 * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
 | 
					 | 
				
			||||||
 * Copyright (C) 2003-2021 The IdeaVim authors
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is free software: you can redistribute it and/or modify
 | 
					 | 
				
			||||||
 * it under the terms of the GNU General Public License as published by
 | 
					 | 
				
			||||||
 * the Free Software Foundation, either version 2 of the License, or
 | 
					 | 
				
			||||||
 * (at your option) any later version.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * This program is distributed in the hope that it will be useful,
 | 
					 | 
				
			||||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					 | 
				
			||||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 | 
					 | 
				
			||||||
 * GNU General Public License for more details.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * You should have received a copy of the GNU General Public License
 | 
					 | 
				
			||||||
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
package com.maddyhome.idea.vim.vimscript.model.functions.handlers
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.intellij.refactoring.rename.inplace.InplaceRefactoring
 | 
					 | 
				
			||||||
import com.intellij.vim.annotations.VimscriptFunction
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.api.ExecutionContext
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.api.VimEditor
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.newapi.ij
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.vimscript.model.VimLContext
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimInt
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.vimscript.model.expressions.Expression
 | 
					 | 
				
			||||||
import com.maddyhome.idea.vim.vimscript.model.functions.FunctionHandler
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@VimscriptFunction(name = "renaming")
 | 
					 | 
				
			||||||
internal class RenamingFunctionHandler : FunctionHandler() {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  override val minimumNumberOfArguments = 0
 | 
					 | 
				
			||||||
  override val maximumNumberOfArguments = 0
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  override fun doFunction(
 | 
					 | 
				
			||||||
    argumentValues: List<Expression>,
 | 
					 | 
				
			||||||
    editor: VimEditor,
 | 
					 | 
				
			||||||
    context: ExecutionContext,
 | 
					 | 
				
			||||||
    vimContext: VimLContext,
 | 
					 | 
				
			||||||
  ): VimDataType {
 | 
					 | 
				
			||||||
    return if (InplaceRefactoring.getActiveInplaceRenamer(editor.ij) == null)
 | 
					 | 
				
			||||||
      VimInt.ZERO
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      VimInt.ONE
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -24,6 +24,5 @@
 | 
				
			|||||||
    <vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.JoinFunctionHandler" name="join"/>
 | 
					    <vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.JoinFunctionHandler" name="join"/>
 | 
				
			||||||
    <vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.SplitFunctionHandler" name="split"/>
 | 
					    <vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.SplitFunctionHandler" name="split"/>
 | 
				
			||||||
    <vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.GetFunctionHandler" name="get"/>
 | 
					    <vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.GetFunctionHandler" name="get"/>
 | 
				
			||||||
    <vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.RenamingFunctionHandler" name="renaming"/>
 | 
					 | 
				
			||||||
  </extensions>
 | 
					  </extensions>
 | 
				
			||||||
</idea-plugin>
 | 
					</idea-plugin>
 | 
				
			||||||
@@ -19,7 +19,7 @@
 | 
				
			|||||||
  <!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
 | 
					  <!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
 | 
				
			||||||
  <!-- Check for [Version Update] tag in YouTrack as well -->
 | 
					  <!-- Check for [Version Update] tag in YouTrack as well -->
 | 
				
			||||||
  <!-- Also, please update the value in build.gradle.kts file-->
 | 
					  <!-- Also, please update the value in build.gradle.kts file-->
 | 
				
			||||||
  <idea-version since-build="231.7515.13"/>
 | 
					  <idea-version since-build="232"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform (including CWM) -->
 | 
					  <!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform (including CWM) -->
 | 
				
			||||||
  <depends>com.intellij.modules.platform</depends>
 | 
					  <depends>com.intellij.modules.platform</depends>
 | 
				
			||||||
@@ -134,5 +134,6 @@
 | 
				
			|||||||
    </group>
 | 
					    </group>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <action id="VimFindActionIdAction" class="com.maddyhome.idea.vim.listener.FindActionIdAction"/>
 | 
					    <action id="VimFindActionIdAction" class="com.maddyhome.idea.vim.listener.FindActionIdAction"/>
 | 
				
			||||||
 | 
					    <action id="VimJumpToSource" class="com.intellij.diff.actions.impl.OpenInEditorAction" />
 | 
				
			||||||
  </actions>
 | 
					  </actions>
 | 
				
			||||||
</idea-plugin>
 | 
					</idea-plugin>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@ public class FilterVisualLinesAction : VimActionHandler.SingleExecution() {
 | 
				
			|||||||
  override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
 | 
					  override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
 | 
					  override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
 | 
				
			||||||
 | 
					    injector.markService.setVisualSelectionMarks(editor)
 | 
				
			||||||
    injector.processGroup.startFilterCommand(editor, context, cmd)
 | 
					    injector.processGroup.startFilterCommand(editor, context, cmd)
 | 
				
			||||||
    editor.exitVisualMode()
 | 
					    editor.exitVisualMode()
 | 
				
			||||||
    return true
 | 
					    return true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -144,7 +144,7 @@ public interface VimChangeGroup {
 | 
				
			|||||||
    operatorArguments: OperatorArguments,
 | 
					    operatorArguments: OperatorArguments,
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public fun insertText(editor: VimEditor, caret: VimCaret, offset: Int, str: String): VimCaret
 | 
					  public fun insertText(editor: VimEditor, caret: VimCaret, offset: Int, str: CharSequence): VimCaret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public fun insertText(editor: VimEditor, caret: VimCaret, str: String): VimCaret
 | 
					  public fun insertText(editor: VimEditor, caret: VimCaret, str: String): VimCaret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -202,7 +202,7 @@ public abstract class VimChangeGroupBase : VimChangeGroup {
 | 
				
			|||||||
   * @param caret  The caret to start insertion in
 | 
					   * @param caret  The caret to start insertion in
 | 
				
			||||||
   * @param str    The text to insert
 | 
					   * @param str    The text to insert
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  override fun insertText(editor: VimEditor, caret: VimCaret, offset: Int, str: String): VimCaret {
 | 
					  override fun insertText(editor: VimEditor, caret: VimCaret, offset: Int, str: CharSequence): VimCaret {
 | 
				
			||||||
    (editor as MutableVimEditor).insertText(Offset(offset), str)
 | 
					    (editor as MutableVimEditor).insertText(Offset(offset), str)
 | 
				
			||||||
    val newCaret = caret.moveToInlayAwareOffset(offset + str.length)
 | 
					    val newCaret = caret.moveToInlayAwareOffset(offset + str.length)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user