t9md / atom-vim-mode-plus

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

yy inconsistently includes trailing newline #1049

Open dpendolino opened 6 years ago

dpendolino commented 6 years ago

Any single line operation like yy then p or dd then p usually includes the trailing newline. It's annoying to have to manually insert a new line when yanking text and putting is somewhere else.

atom-vim-yank-2018-03-21_08 30

I usually see the behavior depicted above but on rare sessions it does work as expected. It doesn't last and either a reboot or update reverts the behavior.

Based on VIM itself I assume the correct behavior is to include the newline, and this is a bug. If that's not the case can this issue be marked a feature request? Thanks!

Then execute Vim Mode Plus: Clip Debug Info(which write info to clipboard) then paste here.

debug info ```json { "atom": "1.25.0", "platform": "linux", "release": "4.15.9-1-ARCH", "vmpVersion": "1.31.1", "vmpConfig": { "blackholeRegisteredOperators": [], "startInInsertModeScopes": [], "charactersToAddSpaceOnSurround": [], "highlightSearchExcludeScopes": [], "flashOnOperateBlacklist": [] } } ```
$ atom --version
Atom    : 1.25.0
Electron: 1.7.11
Chrome  : 58.0.3029.110
Node    : 7.9.0

Read and check all "Check list" bellow.

Check list

You have to check all before open issue.

t9md commented 6 years ago

I cannot understand your explanation clearly. Please follow this instruction you checked.

Express "what" you want(feature? config option?, behavior change?) in short sentence(not long!). Contrast current behavior if you want to change current behavior, with sample text, operation(keystroke) and result.

Are you saying yy sometimes include newline but sometimes not. And want yy always yank newline?

t9md commented 6 years ago

OK. Now I understand your request after seeing GIF. And you can say it's BUG. And I know why it's happening. Not high priority to fix.

dpendolino commented 6 years ago

No worries, I was just typing a better explanation when you responded again.

Got it, thanks! If the fix is small, can you let me know what it is and I can patch for myself?

t9md commented 6 years ago

Oh, but I can't reproduce it. I'm macOS user. I thought y y p on last buffer line(which line have NO ending new line) is the condition to reproduce. But I cannot reproduce it. How do you reproduce GIF? Sample text, exact keystrokes?

dpendolino commented 6 years ago

To repro the gif:

  1. Type some text, leave cursor anywhere on line
  2. yy
  3. p

The text on my systems will be placed where the cursor is and not on the next line, like I would expect.

t9md commented 6 years ago

Here is my case. repro

dpendolino commented 6 years ago

Oh I forgot to mention I did try is with both Unix and Dos line endings and reproduced with both.

t9md commented 6 years ago

The issue happens only in last line in editor and that last line must not have ending new line right? By default saving buffer automatically add ending newline, so after you save buffer. You no longer hit issue with that last line right?

Does my above understanding is sync with what you observed?

dpendolino commented 6 years ago

No it happens on most lines regardless of it's position in the file. Even after a save, it still inserts text.

t9md commented 6 years ago

No it happens on most lines regardless of it's position in the file. Even after a save, it still inserts text.

Humm, then the issue is NOT what I imagined originally.

Can you reproduce it always? Found concrete condition? I never hit such issue?

When you do y y p, observe what command actually invoked by keybinding-resolver. It should be y(yank), y(yank), p(put-after)

dpendolino commented 6 years ago

Yeah you're right, this is weirder than I originally though too.

Check out how inconsistent it is:

peek 2018-03-21 09-34

All I'm doing is moving the cursor then hitting yyp

dpendolino commented 6 years ago

From the keybinding resolver I get the following when the issue occurs: vim-mode-plus:yank vim-mode-plus:yank vim-mode-plus:put-after

When it works correctly: vim-mode-plus:yank vim-mode-plus:yank vim-mode-plus:put-after

t9md commented 6 years ago

Humm, it's really strange. From the keybinding resolver result you reported, it's seem to bug of vmp. But I have no idea what cause this.

I want to find concrete repro condition. And also want to collect report from other people(maybe it's happens only in linux??? not sure).

For now, I can do nothing. So will wait for more info comes in.

dylanpjx commented 4 years ago

I have somewhat of the same issue, but mine is when using ex-mode along with vim-mode-plus.

  1. Shift-v to visual select a few lines
  2. Press : to call up ex-mode, presses d for delete
  3. The deletion always includes the line directly after my selection block.

For instance if i selected

line 4 will be deleted as well. However this doesn't happen when i just press d and don't use ex-mode.