zsh-vi-mode icon indicating copy to clipboard operation
zsh-vi-mode copied to clipboard

Pasting in normal mode breaks

Open BerkeleyTrue opened this issue 4 years ago • 28 comments

Not sure exactly when this started happening, but pasting breaks in subtle ways.

image

Here I've entered normal mode, and hit p. This pasted the contents of the buffer below my prompt. I cannot navigate to this content, and hitting dd to delete the line only deleted a single character at the end of that pasted contented.

If I type content in insert mode and then delete the line, my inserted content is deleted and the content that was pasted moves up into the correct position and is delete-able.

This is on the latest content but is reproduce-able a couple of commits back to feat: provide a mechanism to execute extra commands

BerkeleyTrue avatar Jan 10 '21 20:01 BerkeleyTrue

Hi @BerkeleyTrue

Thanks for your actively reporting. And now I have confirm the bug about dd to delete the line but only deleted a single character at the end of content. But the navigation issue has not appeared yet. I will focus to figure out the issues and thanks agian for your support.

Thanks and regards

jeffreytse avatar Jan 11 '21 13:01 jeffreytse

Hi @BerkeleyTrue

Thanks for your patient, and after some effort I have figured out some issues about visual line, such as dd to delete one line or cc to change one line and so on, the commit ( 0bcfe76 ) has fixed the issues mentioned, welcome to update it.

Thanks and regards

jeffreytse avatar Jan 12 '21 13:01 jeffreytse

Looks like there is still some oddness. I'll upload a gif of what I'm experiencing.

On the latest commit:

I first open a new term, and switch to normal mode. Then I hit p three times with a slight pause in between each. No results

Then I switch back to insert mode and again into normal mode and repeat the process. No results.

Then I switch back and forth and hit Shift and C-v to paste which does work in a way but it seems like I have to hit enter to accept the paste.

dd works to delete the line, now I hit p I get that weird behavior where it pastes below the line and again in the same way where I have to hit enter to accept the paste.

zsh-vi-mode-behavior

BerkeleyTrue avatar Jan 15 '21 20:01 BerkeleyTrue

Hi @BerkeleyTrue

So many thanks for your details about the issue, and my site still can not reproduce the issue. Could we have another approach for digging this issue?

Thanks and regards

jeffreytse avatar Jan 19 '21 15:01 jeffreytse

@jeffreytse how do you mean? I can do some more debugging if you give me some guidance as I'm not that familiar with the inner works of zsh.

BerkeleyTrue avatar Jan 21 '21 16:01 BerkeleyTrue

@BerkeleyTrue

I means that if you could provide the details about your enviroment, such as plugins that you are using and so on, maybe it is a conflict on some plugin. Or that we can talk with one IM, maybe it is better. : )

Thanks and regards

jeffreytse avatar Jan 26 '21 16:01 jeffreytse

@jeffreytse Here are the plugins and config I use for zsh https://github.com/berkeleytrue/dotfiles/blob/master/.config/zsh/.zshrc And my theme https://github.com/berkeleytrue/dotfiles/blob/master/.config/zsh/ghanima.zsh-theme

BerkeleyTrue avatar Feb 02 '21 14:02 BerkeleyTrue

Hi @BerkeleyTrue

Thanks for your instructions to help me to check this issue, now your issue about weird paste has been addressed, this issue caused by your .zshrc at L102, here you put your content to the CUTBUFFER, so you hit p will put the content after the current line.

Thanks and regards

jeffreytse avatar Feb 03 '21 08:02 jeffreytse

@jeffreytse Thanks for looking into it. Should I remove the offending code? I put that code together several years ago so I'm sure a lot has changed in zsh.

Edit: Removing that functionality doesn't seem to fix the behavior.

BerkeleyTrue avatar Feb 03 '21 16:02 BerkeleyTrue

Hi @BerkeleyTrue

Remove the offending code can fix your issue, actually I have reproduced your issue in my side with your dotfile, I have commit a PR for you, you can have a try.

Thanks and regards

jeffreytse avatar Feb 07 '21 01:02 jeffreytse

@jeffreytse I just gave it a try and I was still seeing the same behavior

BerkeleyTrue avatar Feb 07 '21 03:02 BerkeleyTrue

Hi @BerkeleyTrue

I want to know whether you are using the command line by remote ssh?

Thanks and regards

jeffreytse avatar Feb 07 '21 03:02 jeffreytse

I use kitty terminal and run tmux but I am local to my machine

BerkeleyTrue avatar Feb 07 '21 17:02 BerkeleyTrue

Hi @BerkeleyTrue

I have tried again your issue, it is a feature in fact, because you use dd to delete one line, you use p will put the line after current line and the paste content will be highlighted also. You can usee P to paste before current line.

Thanks and regards

jeffreytse avatar Feb 08 '21 06:02 jeffreytse

@jeffreytse I think that the red highlighting caused the confusion. In my opinion red is not really a good color, because we associate it with errors.

weisbrja avatar Apr 02 '21 09:04 weisbrja

Hi @weisbrja, thanks for the suggestion, I will take a consideration for a better highlight background color by default in the future.

jeffreytse avatar Apr 02 '21 11:04 jeffreytse

also something maybe related: when I'm in normal mode, and I paste using ctrl+shift+v it filters all "g" characters from the string I pasted. And if it contained a double "gg" it would only leave one "g"

So when I paste "gregor" in normal mode, I get "reor"

gregorriegler avatar Aug 18 '21 17:08 gregorriegler

Hi @gregorriegler

The issue you mentioned, I can not reproduce in my environment, could you tell me more details about it?

Thanks and Regards

jeffreytse avatar Aug 19 '21 02:08 jeffreytse

Ubuntu 20.04.2 LTS x86_64 with i3 Kernel: 5.4.0-81-generic Shell: zsh 5.8 (x86_64-ubuntu-linux-gnu) Terminal: x-terminal-emul

Reproducable with a zshrc with just zsh-vi-mode installed

gregorriegler avatar Aug 19 '21 06:08 gregorriegler

I should add: happens in alacritty as well as in gnome-terminal

gregorriegler avatar Aug 20 '21 12:08 gregorriegler

@gregorriegler Thanks for your useful information.

jeffreytse avatar Aug 20 '21 12:08 jeffreytse

I am now on an ArcoLinux Distribution Kernel: 5.13.12-arch1-1 Shell: zsh 5.8 Terminal: alacritty and I am able to reproduce this Issue I had on Ubuntu with the filtered out g's

gregorriegler avatar Aug 21 '21 11:08 gregorriegler

@gregorriegler Than you! I will reply here if I get progress on it.

jeffreytse avatar Aug 21 '21 12:08 jeffreytse

Hi @gregorriegler

I still can not reproduce your issue, I think it's something about your .zshrc configuration, such as plugin clash. You can have a check which row of your .zshrc making this issue.

https://user-images.githubusercontent.com/9413601/130899278-2153e8e7-ba4f-462a-bc37-578c4a08d2cd.mp4

Thanks and Regards

jeffreytse avatar Aug 26 '21 04:08 jeffreytse

@gregorriegler What zsh-vi-mode version are you using?

jeffreytse avatar Aug 27 '21 03:08 jeffreytse

The latest from master branch. Hopefully, I find the time this weekend to make a quick video with a zshrc with only one module. Wondering what else could have an impact on this behaviour. Maybe my keyboard layout? I am using a German Keyboard Layout.

gregorriegler avatar Aug 27 '21 13:08 gregorriegler

vi-mode-insert-normal-mode

gregorriegler avatar Aug 27 '21 16:08 gregorriegler

Hello, I've switched back to zsh-vim-mode now for a couple of months and I haven't noticed and issues with pasting.

Don't know if others are having issues still that require this issue to remain open?

BerkeleyTrue avatar Oct 28 '23 21:10 BerkeleyTrue