Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect behaviour of visual block paste #1894

Closed
p00f opened this issue Apr 28, 2024 · 14 comments
Closed

incorrect behaviour of visual block paste #1894

p00f opened this issue Apr 28, 2024 · 14 comments

Comments

@p00f
Copy link

p00f commented Apr 28, 2024

Issue type

  • Bug report

Environment

Emacs version: GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)
Operating System: Arch Linux
Evil version: Evil version 1.15.0
Evil installation type: MELPA
Graphical/Terminal: Graphical
Tested in a make emacs session (see CONTRIBUTING.md): Yes

Reproduction steps

  • Start Emacs
  • Open this file:
aaaaaaaaaaaaa
bbbbbbbb
cccc
  • Do the following (I recorded a macro and opened it in the macro editor C-x C-k C-e)
;; Keyboard Macro Editor.  Press C-c C-c to finish; press C-x k RET to cancel.
;; Original keys: G k C-v g g $ y A 7*SPC <escape> p

Command: last-kbd-macro
Key: none

Macro:

G			;; evil-goto-line
k			;; evil-previous-line
C-v			;; evil-visual-block
g g			;; evil-goto-first-line
$			;; evil-end-of-line
y			;; evil-yank
A			;; evil-append-line
7*SPC			;; evil-forward-char
<escape>		;; evil-force-normal-state
p			;; evil-paste-after

Expected behavior

Tested in neovim:

aaaaaaaaaaaaa       aaaaaaaaaaaaa
bbbbbbbb            bbbbbbbb
cccc                cccc

Actual behavior

aaaaaaaaaaaaa       aaaaaaaaaaaaa
bbbbbbbb     
cccc         
bbbbbbbb
cccc

Further notes

@p00f p00f changed the title visual block paste incorrect behaviour of visual block paste Apr 28, 2024
@axelf4
Copy link
Collaborator

axelf4 commented Apr 29, 2024

I am unable to reproduce using make emacs with GNU Emacs 29.3 in terminal.

tomdl89 added a commit to tomdl89/evil that referenced this issue Apr 29, 2024
@tomdl89
Copy link
Member

tomdl89 commented Apr 29, 2024

Yeah I also can't repro. And the test in the above commit passes on all emacs versions we test for.

Also, for posterity, the keypresses seem wrong (i.e. they don't result in that output in vim either). Should be, with cursor on first a:

C-v
G
$
y
A
7*SPC
<escape>
p

but as I said, this also works in evil for me.

@p00f
Copy link
Author

p00f commented Apr 30, 2024

Yeah I also can't repro. And the test in the above commit passes on all emacs versions we test for.

Also, for posterity, the keypresses seem wrong (i.e. they don't result in that output in vim either). Should be, with cursor on first a:

C-v
G
$
y
A
7*SPC
<escape>
p

but as I said, this also works in evil for me.

I can reproduce your steps in make emacs too
Screenshot from 2024-04-30 at 14_41_49 465644725

@tomdl89
Copy link
Member

tomdl89 commented Apr 30, 2024

I get that same result if I press C-r " in insert mode rather than p in normal mode, but that is consistent with vim anyway.

@tomdl89
Copy link
Member

tomdl89 commented Apr 30, 2024

Interestingly, if I undo that, then paste with p, I do get the result you get. Which is inconsistent with vim... I feel like I'm getting close to a repro here.

@p00f
Copy link
Author

p00f commented Apr 30, 2024

Also, for posterity, the keypresses seem wrong (i.e. they don't result in that output in vim either).

Vim doesn't need the k after the G because it doesn't actually go to the final newline

tomdl89 added a commit to tomdl89/evil that referenced this issue Apr 30, 2024
tomdl89 added a commit that referenced this issue Apr 30, 2024
@tomdl89
Copy link
Member

tomdl89 commented Apr 30, 2024

@p00f I can't really see why it would, but do you want to pull master and see if my latest change makes any difference? Otherwise, any clue as to why your setup would be any different from mine would be helpful. I'm running the same version of Emacs with the same version of evil on the same OS, so it does sound more likely a repro steps difference.

@p00f
Copy link
Author

p00f commented Apr 30, 2024

Nope

@tomdl89
Copy link
Member

tomdl89 commented Apr 30, 2024

OK, I can't promise I'll look any further into this until you can supply repro steps that work on my machine, but I'll leave it open in case you do.

@p00f
Copy link
Author

p00f commented Apr 30, 2024

Is make emacs not clean enough, should I try installing evil on emacs -Q?

@tomdl89
Copy link
Member

tomdl89 commented Apr 30, 2024

make emacs is emacs -Q (plus loading the necessary evil files), so I can't imagine that would make any difference.

@tomdl89
Copy link
Member

tomdl89 commented May 7, 2024

@p00f do you have any clipboard manager that may be interfering? One way to eliminate that would be to yank into a register and paste from it. E.g.

"               ; <- do this before C-v because doing it after $ loses the eol-anchoring
x
C-v
G
$
y
A
7*SPC
<escape>
"
x
p

As commented, I've realised that choosing a register breaks the end-of-line selection. That's a bug that needs fixing. But ignoring that, let me know if the above gets you the correct result. If it does, it implies that something (probably outside of emacs) is clobbering the copied text.

@p00f
Copy link
Author

p00f commented May 7, 2024

It does get the correct result, but I use the same clipboard manager with neovim (clipman) and it behaves correctly

@p00f
Copy link
Author

p00f commented May 7, 2024

It works correctly after reinstalling emacs (or maybe because some package got upgraded), sorry for wasting your time

@p00f p00f closed this as completed May 7, 2024
@p00f p00f closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants