t9md / atom-vim-mode-plus

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

Find `f`/`F`/`t`/`T` and replace `r` are broken when Soft Wrap Hanging Indent is set #869

Closed intrepidcoder closed 7 years ago

intrepidcoder commented 7 years ago

When Soft Wrap Hanging Indent is set for the plain text language, the find motions (f/F/t/T) and the replace command (r) are broken. This behavior is observed for all language types, not only plain text.

Demo

vim-mode-plus-bug

Minimal config.cson to reproduce

".plain.text":
  editor:
    softWrap: true
    softWrapHangingIndent: 4

Removing softWrapHangingIndent: 4, fixes the problem.

t9md commented 7 years ago

Broken how? Cannot get it from GIF. Need short explanation sentence.

intrepidcoder commented 7 years ago

Here is an explanation of the actual behavior:

t9md commented 7 years ago

I tried, but could not reproduce.

I set softWrapHangingIndent to 4. And tried with and without softwrapped text. But I still can use r and f without any issue.

When you can repro issue, the line your cursor is on is wrapped?

I'm macOS user btw.

intrepidcoder commented 7 years ago

When you tried, did you set softWrapHangingIndent in the global editor settings? Because that does not cause the issue for me; it only happens when softWrapHangingIndent is set specifically for the plain text language. Can you trying using the exact config.cson file I included?

".plain.text":
  editor:
    softWrap: true
    softWrapHangingIndent: 4

It does not matter whether the line the cursor is on is wrapped or not.

I was able to reproduce the issue on both Debian Linux and Windows, but I don't have access to a Mac.

t9md commented 7 years ago

Thanks! I could repro. Setting softWrap and softWrapHangingIndent in .plain.text grammar affects all behavior of f and r in other grammar. This is because mini-input editor's grammar used in f and r input is text.plain.null-grammar.

I think I can fix this easily will check from now.

t9md commented 7 years ago

editor.onDidChange fired with empty text without any keytype(initial focus) if “softWrap and softWrapHangingIndent > 0”.

Disabling softrwap on mini-editor did not help to solve this issue.

Not sure this behavior is bug or not.

I can avoid this unwanted event triggering by using different event(editor.buffer.onDidChangeText).

t9md commented 7 years ago

Will release as v1.4.0 maybe this week.