Re: [dev] ncurses or ...

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Fri, 31 Jan 2014 11:26:16 +0100

> > I didn't know about libvitapi. I'll check it.
> > About line editors: COME ON.
>
> Line editors have their uses once you work with them a bit more.

Yeah, I agree. I use ed a lot for scripts and for fc (I use fc
when the command is complex).


>
> > About compatibility/portability: I want the library to work for me. I don't care about anyone else. So it's gonna be compatible with xterm and st. Not even urxvt!
>
> Even with st, we have so many different modes (256-color and the like).

Only for testing:

        - Apply the patch in st:

diff --git a/config.def.h b/config.def.h
index 986f6e2..164b4a4 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -109,7 +113,7 @@ static Shortcut shortcuts[] = {
        /* mask keysym function argument */
        { MODKEY|ShiftMask, XK_Prior, xzoom, {.i = +1} },
        { MODKEY|ShiftMask, XK_Next, xzoom, {.i = -1} },
- { ShiftMask, XK_Insert, selpaste, {.i = 0} },
        { MODKEY|ShiftMask, XK_Insert, clippaste, {.i = 0} },
        { MODKEY, XK_Num_Lock, numlock, {.i = 0} },
 };


        - write this line in st:
tput rmkx && stty -echo cbreak min 1 && clear && cat

And now you have a screen editor, with the next hotkeys:

        - Insert: sets the terminal in insert mode.
        - Shift + Insert: sets the terminal in replace mode.
        - Control + Insert: Insert a new line in the position where is
          located the cursor
        - Supr: delete the character under the cursor
        - Control + Delete : clears the screen
        - Home: goes to first position in the screen
        - Control + End : Clears until end of screen
        - Shift + End : clears until end of line
        - Cursor keys : Move the cursos in the screen
        - Control + H : Backspace
        - There are more key combinations, look them in config.def.h

(After this test you will need reset your terminal to return
to normal mode) You can see that the terminal already has the
important functions. Curses is only a layer which translate
between keys and escape sequences, but you already have the
ascii mode of the terminal where all the keys generate the correct
sequence for the function that they are supposed to implement.

Regards,

-- 
Roberto E. Vargas Caballero
Received on Fri Jan 31 2014 - 11:26:16 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 31 2014 - 11:36:07 CET