mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-25 00:34:09 +02:00
Fix issues with command line prompt processing
This commit is contained in:
parent
6feb1a4525
commit
a925676d64
@ -52,8 +52,8 @@ interface VimCommandLine {
|
|||||||
get() {
|
get() {
|
||||||
val promptCharacterOffset1 = promptCharacterOffset
|
val promptCharacterOffset1 = promptCharacterOffset
|
||||||
return if (promptCharacterOffset1 == null) visibleText else {
|
return if (promptCharacterOffset1 == null) visibleText else {
|
||||||
if (promptCharacterOffset1 > visibleText.length) {
|
if (promptCharacterOffset1 + 1 > visibleText.length) {
|
||||||
logger.error("promptCharacterOffset1 >= visibleText.length: $promptCharacterOffset1 >= ${visibleText.length}")
|
logger.error("promptCharacterOffset1 > visibleText.length: ${promptCharacterOffset1 + 1} > ${visibleText.length}")
|
||||||
visibleText
|
visibleText
|
||||||
} else {
|
} else {
|
||||||
visibleText.removeRange(promptCharacterOffset1, promptCharacterOffset1 + 1)
|
visibleText.removeRange(promptCharacterOffset1, promptCharacterOffset1 + 1)
|
||||||
@ -106,9 +106,13 @@ interface VimCommandLine {
|
|||||||
fun clearPromptCharacter() {
|
fun clearPromptCharacter() {
|
||||||
if (promptCharacterOffset == null) return
|
if (promptCharacterOffset == null) return
|
||||||
|
|
||||||
setText(actualText)
|
// Note: We have to set promptCharacterOffset to null first, because when we set the new text,
|
||||||
caret.offset = min(caret.offset, visibleText.length)
|
// the listener will be called, which will try to get the actual text again. And, if this field isn't null,
|
||||||
|
// it will get an incorrect result.
|
||||||
|
val myActualText = actualText
|
||||||
promptCharacterOffset = null
|
promptCharacterOffset = null
|
||||||
|
setText(myActualText)
|
||||||
|
caret.offset = min(caret.offset, visibleText.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clearCurrentAction()
|
fun clearCurrentAction()
|
||||||
|
Loading…
Reference in New Issue
Block a user