walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
587 stars 17 forks source link

Paste in search field not working #73

Closed ciscohack closed 1 year ago

ciscohack commented 2 years ago

Hi Walles,

Can you please address an issue in moar pager where when one try to copy/paste any search keyword in search field by pressing "/" not working.

walles commented 2 years ago

Confirming.

And FYI I'm a person, not a team.

ciscohack commented 2 years ago

Confirming.

And FYI I'm a person, not a team.

I am sorry for that.

ciscohack commented 2 years ago

@walles will you be going to fix this issue and allow to copy/paste in search field

walles commented 2 years ago

I haven't looked into it, but I'm not sure I can fix it.

I'm reading characters from stdin (basically), and if the pasted chars don't show up there there's not much I can do about it.

So I'd say:

ciscohack commented 2 years ago

Sure no problem. Thanks for ack

forivall commented 1 year ago

Experimenting with iTerm's advanced paste tool, i found that setting chunking to anything other than 1 byte will fail to paste, and setting the interchunk delay to 1ms will drop characters. Screenshot 2023-01-09 at 11 19 43 AM

I would think there's alternative ways to read from stdin which should allow multibyte chunked stdin reads, but then again, i don't know how much it would take to resolve this.

forivall commented 1 year ago

Aha, found the --trace option, here's an example

~pubrepos/moar master
» moar --trace moar.go
Please post the following report at <https://github.com/walles/moar/issues>,
or e-mail it to johan.walles@gmail.com.

Version: v1.11.3
LANG   : en_CA.UTF-8
TERM   : xterm-256color

GOOS    : darwin
GOARCH  : arm64
Compiler: gc
NumCPU  : 10

DEBU[0000] Counted 434 lines in 0ms at 32ns/line
DEBU[0000] Stream read in 0ms
TRAC[0001] ttyin high watermark bumped to 1 bytes
TRAC[0001] Handling rune event '/'/0x002f...
TRAC[0002] ttyin high watermark bumped to 4 bytes
DEBU[0002] Unhandled multi character terminal escape sequence(s): moar
TRAC[0002] Handling key event 1...
TRAC[0003] Handling rune event 'q'/0x0071...

seems like the target line is Unhandled multi character terminal escape sequence(s): moar

Also, it might be worthwhile to support paste bracketing / Bracketed paste

If i enable it manually, i get the following trace:

~pubrepos/moar master 12s
» moar --trace moar.go
DEBU[0000] Counted 434 lines in 0ms at 23ns/line
Please post the following report at <https://github.com/walles/moar/issues>,
or e-mail it to johan.walles@gmail.com.

Version: v1.11.3
LANG   : en_CA.UTF-8
TERM   : xterm-256color

GOOS    : darwin
GOARCH  : arm64
Compiler: gc
NumCPU  : 10

DEBU[0000] Stream read in 0ms
TRAC[0006] ttyin high watermark bumped to 11 bytes
DEBU[0006] Unhandled multi character mouse escape sequence(s):
DEBU[0006] Unhandled multi character terminal escape sequence(s):
TRAC[0007] Handling rune event '/'/0x002f...
TRAC[0012] Handling key event 0...
TRAC[0013] Handling rune event 'q'/0x0071...

here, the parser recognizes the paste as an unknown escape sequence, as bracketed paste surrounds the paste with escape sequences.

walles commented 1 year ago

That --trace output was really interesting, so it seems like it's moar that might be botching this somehow.

I might be able to work with this.

Nice finding @forivall!

walles commented 1 year ago

New release out: https://github.com/walles/moar/releases/tag/v1.11.4

Homebrew packaging in progress: https://github.com/Homebrew/homebrew-core/pull/120316

walles commented 1 year ago

@forivall if you want paste bracketing, please open a separate ticket for that!