martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.19k stars 259 forks source link

libtermkey status & curses cannot be disabled #1071

Open apprehensions opened 1 year ago

apprehensions commented 1 year ago

Note: Use of this library for new programs is discouraged. It is being maintained for legacy purposes only. For writing new programs, please use libtickit instead.

All of the code in this library will be migrated into libtickit in due course; currently it is used via an internal dependency.

libtermkey is a required dependency, and it depends on curses, which will cause a build failure, since curses is needed by a require dependency.

lobre commented 7 months ago

I'm curious here: how helpful is a library such as libtickit for interacting with the terminal, compared to simply using termios?

I don't know the internals of curses/ncurses, but it is sometimes advertised that it is a rather big dependency with a lot of code. And some apps, such as Kakoune, got rid of it and came back to "raw termios".

I guess it is about tradeoff because I suppose curses handles a lot of edge cases for weird terminal emulators or things like that, but it is just speculation.

Personally, I can use Kakoune without a hitch!

I genuinely don't know about this tradeoff, hence interested if people have insight.

rnpnr commented 7 months ago

I'm curious here: how helpful is a library such as libtickit for interacting with the terminal, compared to simply using termios?

Using libtickit has be discussed before. I think the points there are still valid. Particularly the double buffering point (I also haven't looked under the hood in libtickit yet).

In theory it would be quite easy to replace curses with tickit for drawing but the input handling will be an issue. We currently use termkey everywhere without any sort of abstraction. Splitting out the input handling into something more abstracted is important if we ever want to have a server-client architecture but it will be quite some work.

I don't know the internals of curses/ncurses, but it is sometimes advertised that it is a rather big dependency with a lot of code. And some apps, such as Kakoune, got rid of it and came back to "raw termios".

We also have that with ui-vt100.c which is used when building with CONFIG_CURSES=0. I usually use that but it requires that your terminal emulator supports double buffering otherwise you will get flickering. There are a couple other minor differences as well.

lobre commented 7 months ago

We also have that with ui-vt100.c which is used when building with CONFIG_CURSES=0. I usually use that but it requires that your terminal emulator supports double buffering otherwise you will get flickering. There are a couple other minor differences as well.

Interesting, did not know about that. Thank you, I will test this.