1
0
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:
Alex Plate 2019-05-06 14:49:58 +03:00
parent 10c19bbb94
commit 5032bc4da7
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
2 changed files with 9 additions and 2 deletions
src/com/maddyhome/idea/vim
group/visual
listener

View File

@ -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
*/

View File

@ -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)
}