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

Consider moving from ncurses to libtickit #1012

Closed
lenormf opened this issue Dec 16, 2016 · 5 comments
Closed

Consider moving from ncurses to libtickit #1012

lenormf opened this issue Dec 16, 2016 · 5 comments

Comments

@lenormf
Copy link
Contributor

lenormf commented Dec 16, 2016

According to @leonerd, libtickit would provide a superset of ncurses, with the added bonus of True Color support if asked for nicely.

The pros are that we get rid of an old library whose API isn't the best.

The cons are migrating to a new library might introduce more bugs, or maybe lead to cases where something implemented with ncurses isn't as easily done with the new lib.

Discuss.

@occivink
Copy link
Contributor

Would it also be possible to differentiate mappings like <tab> and <c-i> with this library? And map function keys?

@mawww
Copy link
Owner

mawww commented Dec 16, 2016

I think if we ever get rid of ncurses, its probably going to be for a direct terminal output, just using terminfo.

libtickit is not a common enough library so that I'd feel comfortable adding it as a dependency.

The way we do the output in ncurses is already not relying on much more than filling the ncurses screen and blitting that. Ncurses does some fancy things behind to optimize the redraw commands, but the biggest one should be pretty easy to implement ourselves as we already have a diff implementation.

For the input part, we already parse some CSI ourselves for FocusIn/FocusOut, and we could extend that to support libtickit proposed input format, but it looks like most terminals dont emit that anyway.

Regarding 24bit support, I dont think we actually need it, we never have more than 256 colors at once on the screen, we'd better use the palette changing, which is already implemented, and is much more performant. What we need is palette reset (OSC 104) support in the terminal emulators that dont support it yet (rxvt-unicode comes to mind), and palette change support as well (tmux does not).

In general, I think we are fine with ncurses for the most part. The only real pain point is input handling, but we wont get any gains until terminal emulators start supporting unambiguous key representation.

@lenormf
Copy link
Contributor Author

lenormf commented Dec 16, 2016

How would input handling be better using libtickit ? Complaints regarding the default alt/ctrl binding are recurrent, and apparently the lib provides tools to alleviate some of those issues (?).

As for TC support, I'd say most tools that implement it won't bother with palette switching as the latter is mostly considered a workaround, which is why e.g. the maintainer of tmux cba to implement it (he does accept PRs though). In the end, as time goes by, more and more tools will only support TC, and compatibility with other tools that sticked with palette-switching such as Kakoune will be an ever widening gap. If it's not too much work to implement and it's really more efficient, we might as well make 24bit colors an opt-in feature (probably not a good idea but eh).

@leonerd
Copy link

leonerd commented Dec 16, 2016

FYI, the main libtickit manpages are currently found at http://www.leonerd.org.uk/code/libtickit/doc/

@occivink - technically libtickit (via its internal dependency libtermkey) can distinguish a Ctrl-I from a Tab, though most terminals don't send distinct byte sequences for them. A few can, but that tends not to be enabled by default. Part of the reason for declaring libtermkey end-of-life and moving it into libtickit entirely, is so that the output part of the driver can enable that mode, and so more terminals should make it distinct.

@mawww
Copy link
Owner

mawww commented Jan 15, 2017

No plans to switch any time soon, closing for now.

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

4 participants