ov icon indicating copy to clipboard operation
ov copied to clipboard

Some characters are missing when pasted to search prompt with Cmd + v

Open aoyama-val opened this issue 1 year ago • 1 comments

  • macOS Sonoma 14.6.1
  • iTerm2 or Terminal.app
  • ov 0.36.0 rev:d671c94

Although the content of the clipboard is 57f5dd59-7158-495b-82d0-94ba9dc4bc9c, the pasted text becomes 58-495b-82d0-94ba9dc4bc9c. The leading part is missing. I'm not sure if the missing part is always the leading one. When the buffer is large (90KB) this seems to occur. The issue is only with Cmd + v, and Ctrl + v (ov's paste function) seems working perfectly.

aoyama-val avatar Aug 27 '24 05:08 aoyama-val

Thank you.

Is this a problem related to "Bracketed Paste"? https://github.com/gdamore/tcell?tab=readme-ov-file#bracketed-paste

Does it work differently if I run EnablePage() first?

diff --git a/oviewer/oviewer.go b/oviewer/oviewer.go
index c079cec..d601654 100644
--- a/oviewer/oviewer.go
+++ b/oviewer/oviewer.go
@@ -686,6 +686,7 @@ func (root *Root) prepareRun(ctx context.Context) error {
 	if !root.Config.DisableMouse {
 		root.Screen.EnableMouse(MouseFlags)
 	}
+	root.Screen.EnablePaste()
 
 	root.setCaption()
 

noborus avatar Aug 27 '24 14:08 noborus

I also suspected bracketd paste, but disabling it in iTerm2 didn't change anything. In Terminal.app, I could not even find the setting. The issue was also reproduced in kitty and WezTerm.

By the patch, paste became slower, but the result was the same.

There was a case in which the middle part was lost. c6c0796d-4a67-40f5-8e47-eed8454200c2 became c7-40f5-8e47-eed8454200c2

aoyama-val avatar Aug 28 '24 12:08 aoyama-val

Ummm. I don't know where the cause is yet.

noborus avatar Aug 30 '24 10:08 noborus

Disabled incremental search and it is working well.

Incsearch: false

aoyama-val avatar Aug 30 '24 16:08 aoyama-val

Thank you!

That's why an event will occur one character? !

Will it work correctly by canceling the incremental search when there is a pending event?

diff --git a/oviewer/search.go b/oviewer/search.go
index 7ba9f17..e463a4a 100644
--- a/oviewer/search.go
+++ b/oviewer/search.go
@@ -535,6 +535,9 @@ func (root *Root) sendSearchMove(lineNum int) {
 
 // incrementalSearch performs incremental search by setting and input mode.
 func (root *Root) incrementalSearch(ctx context.Context) {
+	if root.Screen.HasPendingEvent() {
+		return
+	}
 	if !root.Config.Incsearch {
 		return
 	}

noborus avatar Aug 30 '24 22:08 noborus

Thank you for investing. Now it's working perfectly 🎉

aoyama-val avatar Aug 31 '24 16:08 aoyama-val

Thank you for reporting. Fixed with #616.

noborus avatar Sep 01 '24 01:09 noborus