kilo icon indicating copy to clipboard operation
kilo copied to clipboard

Use curses to support non-vt100 terminals? (request)

Open wyatt8740 opened this issue 8 years ago • 4 comments

I have an IBM 3161 ASCII terminal. The point of using curses is to make your programs terminal-independent. I think it'd be a very good idea to add it (though I understand this may push the 'lines of code' up a lot).

Image of IBM 3161 ASCII Display Station

If your intention is portability, curses is the way to go. VT100 codes are not universal, although they are common. The 3161 doesn't emulate a VT100 either; it emulates the ADDS Viewpoint, ADM-3A, ADM-5, Hazeltine 1500, IBM 3101, and TeleVideo 910. None of those are VT100 compatible.

Alternately, a method to manually supply alternate escape codes would be good.

wyatt8740 avatar Jul 14 '16 15:07 wyatt8740

Alternately, a method to manually supply alternate escape codes would be good.

i think this would be the way to go. like

#ifndef _KILO_ESCAPES
#define _KILO_ESCAPES
#define ESC_GO_RIGHT(n) ("\x1b[" #n "C")
#define ESC_GO_RIGHT(n) ("\x1b[" #n "B")
#endif

and then in the code:

/* Go to right/bottom margin and get position. */
if (write(ofd, ESC_GO_RIGHT(999) ESC_GO_DOWN(999), <calc length>) != 12) goto failed;

and if you want to override, just do $(CC) -o kilo my_term_escapes.c kilo.c …

flying-sheep avatar Sep 14 '17 09:09 flying-sheep

This'd probably work, I'll try it. (Not sure why people are "thumbs-downing" more compatibility...)

wyatt8740 avatar Sep 15 '17 18:09 wyatt8740

I believe this project is just a fun, proof-of-concept minimal text editor, which can be used to build on. Also if you look at the commit log you can see there are no updates since Jul 10, 2016, even with smaller pull requests, so i doubt curses will be added ..

erf avatar Sep 16 '17 12:09 erf

I believe this project is just a fun, proof-of-concept minimal text editor, which can be used to build on

yeah, that’s probably the idea. this project is about seeing what’s going on. ncurses is too “magic” for this project.

flying-sheep avatar Sep 16 '17 14:09 flying-sheep