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

add support for win32-input-mode #2770

Open
unxed opened this issue Mar 19, 2024 · 6 comments
Open

add support for win32-input-mode #2770

unxed opened this issue Mar 19, 2024 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request input readin' dem bytes mswindows microsoft windows

Comments

@unxed
Copy link

unxed commented Mar 19, 2024

kitty's enhanced keyboard protocol is not the only existing enhanced keyboard protocol supported by terminals. There also exist the other one, called win32-input-mode.

Protocol spec:
https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md

Reference implementation on the terminal side:
wez/wezterm#1509

Reference implementation on the console app side:
elfmz/far2l#1581

Reference implementation on the TUI framework side:
magiblot/tvision@5c017a8

NB! Windows Terminal's implementation is buggy and needs a special workaround for handling mouse events properly. Reference implementations of such workaround:
elfmz/far2l#2085
magiblot/tvision@ae1a685

@unxed unxed added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 19, 2024
@dankamongmen dankamongmen self-assigned this Mar 20, 2024
@dankamongmen dankamongmen added the mswindows microsoft windows label Mar 20, 2024
@dankamongmen
Copy link
Owner

interesting, thanks for bringing this to my attention!

@dankamongmen dankamongmen added the input readin' dem bytes label Mar 20, 2024
@unxed
Copy link
Author

unxed commented Mar 20, 2024

Nice to hear that! If so, it's probably worth mentioning some other TUI UX enriching techniques:

  1. far2l terminal extensions (reach keyboard support, clipboard, desktop notifications)
    https://github.com/elfmz/far2l/blob/master/WinPort/FarTTY.h
    Supported by cyd01's kitty, Turbo Vision, some other apps

  2. iTerm2's RAW input mode
    https://gitlab.com/gnachman/iterm2/-/issues/7440#note_129307021
    Supported by far2l (in TTY backend only, not in the internal VT)

  3. OSC52 for clipboard access. Supported by far2l, kovidgoyal's kitty (with it's own extensions) and in some other apps
    https://bugs.kde.org/show_bug.cgi?id=372116
    https://sw.kovidgoyal.net/kitty/clipboard/

  4. Bracketed paste (as not all terminals supporting OSC52 support it for paste operation, it is often used as alternative).
    support bracketed paste mode #2704

@dankamongmen
Copy link
Owner

Nice to hear that! If so, it's probably worth mentioning some other TUI UX enriching techniques:

  1. far2l terminal extensions (reach keyboard support, clipboard, desktop notifications)

i haven't looked at this yet, but clipboard/desktop etc. seems better handled by the terminal emulator itself? i definitely don't want to go talking to desktop notification APIs, i think.

  1. iTerm2's RAW input mode
    https://gitlab.com/gnachman/iterm2/-/issues/7440#note_129307021
    Supported by far2l (in TTY backend only, not in the internal VT)

i'll take a look at this

  1. OSC52 for clipboard access. Supported by far2l, kovidgoyal's kitty (with it's own extensions) and in some other apps

same as 1 above

  1. Bracketed paste (as not all terminals supporting OSC52 support it for paste operation, it is often used as alternative).
    support bracketed paste mode #2704

i'd considered this and it too seems to be a TE thing, no?

@unxed
Copy link
Author

unxed commented Mar 20, 2024

i haven't looked at this yet, but clipboard/desktop etc. seems better handled by the terminal emulator itself?

OSC52 and far2l extensions are supported in at least one TUI framework:
magiblot/tvision#82 (comment)

i'd considered this and it too seems to be a TE thing, no?

TE should support it too, of course. But the app (or is framework) also should.
https://en.wikipedia.org/wiki/Bracketed-paste

@dankamongmen
Copy link
Owner

i'd considered this and it too seems to be a TE thing, no?

TE should support it too, of course. But the app (or is framework) also should. https://en.wikipedia.org/wiki/Bracketed-paste

looking at it, i see what you mean. it's not relevant to me necessarily, but i ought maybe expose it to the app.

@neurocyte
Copy link

notcurses already passes escape sequences that it does not implement onwards to the application and I have implemented OSC52 and bracketed paste in my notcurses application with minimal effort even without any help from notcurses.

I'm not sure I see the value of adding clipboard support directly into notcurses itself. What would the API look like and how would it fit into the current input processing model? I assume it would be impossible to implement either clipboard variant without having some sort of (likely unbounded) input buffering inside notcurses. I'm not sure that's a nice way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request input readin' dem bytes mswindows microsoft windows
Projects
None yet
Development

No branches or pull requests

3 participants