mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-07 12:32:52 +01:00
Add some comments to functions
This commit is contained in:
parent
10c19bbb94
commit
5032bc4da7
src/com/maddyhome/idea/vim
@ -125,6 +125,11 @@ val Caret.vimLeadSelectionOffset: Int
|
||||
return caretOffset
|
||||
}
|
||||
|
||||
/**
|
||||
* Update caret's colour according to the current state
|
||||
*
|
||||
* Secondary carets became invisible colour in visual block mode
|
||||
*/
|
||||
fun updateCaretColours(editor: Editor) {
|
||||
val subMode = CommandState.getInstance(editor).subMode
|
||||
if (subMode == CommandState.SubMode.VISUAL_BLOCK) {
|
||||
@ -143,7 +148,7 @@ fun updateCaretColours(editor: Editor) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert vims selection start and end to corresponding native selection.
|
||||
* Convert vim's selection start and end to corresponding native selection.
|
||||
*
|
||||
* Adds caret adjustment or extends to line start / end in case of linewise selection
|
||||
*/
|
||||
|
@ -52,7 +52,7 @@ object IdeaSpecifics {
|
||||
override fun afterActionPerformed(action: AnAction, dataContext: DataContext, event: AnActionEvent) {
|
||||
if (!VimPlugin.isEnabled()) return
|
||||
|
||||
val editor = dataContext.getData(CommonDataKeys.EDITOR) ?: return
|
||||
val editor = event.getData(CommonDataKeys.EDITOR) ?: return
|
||||
when (ActionManager.getInstance().getId(action)) {
|
||||
IdeActions.ACTION_EDITOR_SELECT_WORD_AT_CARET, IdeActions.ACTION_EDITOR_UNSELECT_WORD_AT_CARET -> {
|
||||
// Rider moves caret to the end of selection
|
||||
@ -79,6 +79,8 @@ object IdeaSpecifics {
|
||||
|
||||
val editor = state.editor
|
||||
if (!editor.selectionModel.hasSelection()) {
|
||||
// Enable insert mode if there is no selection in template
|
||||
// Template with selection is handled by [com.maddyhome.idea.vim.group.visual.VisualMotionGroup.controlNonVimSelectionChange]
|
||||
VimPlugin.getChange().insertBeforeCursor(editor, EditorDataContext(editor))
|
||||
KeyHandler.getInstance().reset(editor)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user