1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-29 01:34:10 +02:00

Remove unnecessary keeping visual mode flag

The value was only ever set to false.
This commit is contained in:
Matt Ellis 2023-12-11 23:28:38 +00:00 committed by Alex Pláte
parent 4f407ccc03
commit 8ab43e98fe
5 changed files with 3 additions and 19 deletions
src/main/java/com/maddyhome/idea/vim
vim-engine/src/main/kotlin/com/maddyhome/idea/vim

View File

@ -124,10 +124,6 @@ internal var Editor.vimMorePanel: ExOutputPanel? by userData()
internal var Editor.vimExOutput: ExOutputModel? by userData()
internal var Editor.vimTestInputModel: TestInputModel? by userData()
/**
* Checks whether a keeping visual mode visual operator action is performed on editor.
*/
internal var Editor.vimKeepingVisualOperatorAction: Boolean by userDataOr { false }
internal var Editor.vimChangeActionSwitchMode: Mode? by userData()
/**

View File

@ -54,7 +54,6 @@ import com.maddyhome.idea.vim.helper.isTemplateActive
import com.maddyhome.idea.vim.helper.updateCaretsVisualAttributes
import com.maddyhome.idea.vim.helper.updateCaretsVisualPosition
import com.maddyhome.idea.vim.helper.vimChangeActionSwitchMode
import com.maddyhome.idea.vim.helper.vimKeepingVisualOperatorAction
import com.maddyhome.idea.vim.helper.vimLastSelectionType
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
@ -67,7 +66,7 @@ internal class IjVimEditor(editor: Editor) : MutableLinearEditor() {
companion object {
// For cases where Editor does not have a project (for some reason)
// It's something IJ Platform related and stored here because of this reason
const val DEFAULT_PROJECT_ID = "no project"
const val DEFAULT_PROJECT_ID = "no project"
}
// All the editor actions should be performed with top level editor!!!
@ -82,11 +81,6 @@ internal class IjVimEditor(editor: Editor) : MutableLinearEditor() {
set(value) {
editor.vimChangeActionSwitchMode = value
}
override var vimKeepingVisualOperatorAction: Boolean
get() = editor.vimKeepingVisualOperatorAction
set(value) {
editor.vimKeepingVisualOperatorAction = value
}
override fun fileSize(): Long = editor.fileSize.toLong()

View File

@ -127,7 +127,6 @@ public interface VimEditor {
public val lfMakesNewLine: Boolean
public var vimChangeActionSwitchMode: Mode?
public var vimKeepingVisualOperatorAction: Boolean
public fun fileSize(): Long
@ -242,7 +241,7 @@ public interface VimEditor {
public fun getPath(): String?
public fun extractProtocol(): String?
// Can be used as a key to store something for specific project
public val projectId: String

View File

@ -232,7 +232,6 @@ public sealed class VisualOperatorActionHandler : EditorActionHandlerBase(false)
fun start() {
logger.debug("Preparing visual command")
editor.vimKeepingVisualOperatorAction = false //CommandFlags.FLAG_EXIT_VISUAL !in cmd.flags
editor.forEachCaret {
val change =
@ -268,8 +267,6 @@ public sealed class VisualOperatorActionHandler : EditorActionHandlerBase(false)
}
}
}
editor.vimKeepingVisualOperatorAction = false
}
}

View File

@ -27,9 +27,7 @@ public fun VimEditor.exitVisualMode() {
if (inBlockSelection) {
this.removeSecondaryCarets()
}
if (!this.vimKeepingVisualOperatorAction) {
this.nativeCarets().forEach(VimCaret::removeSelection)
}
this.nativeCarets().forEach(VimCaret::removeSelection)
}
if (this.inVisualMode) {
this.vimLastSelectionType = selectionType