t9md / atom-vim-mode-plus

vim-mode improved
https://atom.io/packages/vim-mode-plus
MIT License
1.4k stars 112 forks source link

`r` command does not work when r", r' and r` #922

Closed t9md closed 7 years ago

t9md commented 7 years ago

Continue discussion made at https://github.com/t9md/atom-vim-mode-plus/issues/282#issuecomment-337576221

Summary

This is my understanding from @vinicius0026's comment below. But I cannot understand why it doesn't throw exception for every attempt to replace to these char. If this issue comes from international keyboard which require extra space to type sole ', it should throw exception regardless of char being replaced.

@t9md It happens when the cursor is over a " or ' or ` characters and then I do r ' or r ". If the cursor is over other characters, the replacement works (I didn't test every possible character combination though). Maybe this has something to do with the issue: my keyboard is configured as USA - International so when I press ', for example, and then press space, only the ' character is outputed, the space is "swallowed". I guess this happens because there are characters that are formed by the combination of ' and other letters, such as ç = ' + c or é = ' + e.

t9md commented 7 years ago

@vinicius0026 I need further clarification.

I want following info for both OK and NG case to understand situation without misunderstanding.

vinicius0026 commented 7 years ago

@t9md Sorry for misleading you, but I though I had tried and succeeded replacing other chars by ' or " (i.e. I thought the error only occurred when replacing these characters), but it really does always occur, regardless of the character being replaced.

So, to make things clear, below are some images and comments on keystrokes, showing all steps to reproduce:

If you need futher clarification, please get in touch. Thank you very much for this amazing package and for your work on maintaining it!

vinicius0026 commented 7 years ago

OS version (just in case you might need this info): macOS 10.12.6

t9md commented 7 years ago

Pls try v1.11.4 and close if you confirmed it fixed.

vinicius0026 commented 7 years ago

@t9md Now it does the replacement correctly, but an exception is still thrown.

Stack trace:

Uncaught TypeError: Cannot read property 'isComplete' of undefined
    at OperationStack.process (/Users/vinicius/.atom/packages/vim-mode-plus/lib/operation-stack.js:180:13)
    at ReplaceCharacter.processOperation (/Users/vinicius/.atom/packages/vim-mode-plus/lib/base.js:119:34)
    at options.onConfirm (/Users/vinicius/.atom/packages/vim-mode-plus/lib/base.js:134:14)
    at confirm (/Users/vinicius/.atom/packages/vim-mode-plus/lib/focus-input.js:37:5)
    at editor.buffer.onDidChangeText (/Users/vinicius/.atom/packages/vim-mode-plus/lib/focus-input.js:56:7)
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/node_modules/event-kit/lib/emitter.js:25:20)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/node_modules/event-kit/lib/emitter.js:141:34)
    at TextBuffer.module.exports.TextBuffer.emitDidChangeTextEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1675:28)
    at TextBuffer.module.exports.TextBuffer.transact (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:975:18)
    at TextEditor.module.exports.TextEditor.transact (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1673:32)
    at /Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1234:30
    at TextEditor.module.exports.TextEditor.mergeSelections (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:2621:24)
    at TextEditor.module.exports.TextEditor.mergeIntersectingSelections (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:2583:41)
    at TextEditor.module.exports.TextEditor.mutateSelectedText (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1232:25)
    at TextEditor.module.exports.TextEditor.insertText (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1198:25)
    at get_process.nextTick (/Applications/Atom.app/Contents/Resources/app/src/text-editor-component.js:1715:34)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
t9md commented 7 years ago

how is the result with v1.11.5?

vinicius0026 commented 7 years ago

@t9md Now it works like a charm! Thank you very much!

t9md commented 7 years ago

Hoo, finally!!