[hackers] [st] Fixing the return and keypad enter sent characters. Terminals produce \r. And || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Thu, 15 Nov 2012 16:28:52 +0100 (CET)

changeset: 413:0868d5c0a2cd
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Thu Nov 15 16:26:50 2012 +0100
files: config.def.h st.c
description:
Fixing the return and keypad enter sent characters. Terminals produce \r. And
some minor style changes.


diff -r 17770cef1d01 -r 0868d5c0a2cd config.def.h
--- a/config.def.h Thu Nov 15 16:21:23 2012 +0100
+++ b/config.def.h Thu Nov 15 16:26:50 2012 +0100
_AT_@ -109,7 +109,7 @@
         { XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +1, 0, 0},
         { XK_KP_Add, XK_ANY_MOD, "\033Ok", +1, 0, 0},
         { XK_KP_Enter, XK_ANY_MOD, "\033OM", +1, 0, 0},
- { XK_KP_Enter, XK_ANY_MOD, "\n", -1, 0, -1},
+ { XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0, -1},
         { XK_KP_Enter, XK_ANY_MOD, "\r\n", -1, 0, +1},
         { XK_KP_Subtract, XK_ANY_MOD, "\033Om", +1, 0, 0},
         { XK_KP_Decimal, XK_ANY_MOD, "\033On", +1, 0, 0},
_AT_@ -146,9 +146,9 @@
         { XK_Right, XK_ANY_MOD, "\033[C", 0, -1, 0},
         { XK_Right, XK_ANY_MOD, "\033OC", 0, +1, 0},
         { XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0, 0},
- { XK_Return, Mod1Mask, "\033\n", 0, 0, -1},
+ { XK_Return, Mod1Mask, "\033\r", 0, 0, -1},
         { XK_Return, Mod1Mask, "\033\r\n", 0, 0, +1},
- { XK_Return, XK_ANY_MOD, "\n", 0, 0, -1},
+ { XK_Return, XK_ANY_MOD, "\r", 0, 0, -1},
         { XK_Return, XK_ANY_MOD, "\r\n", 0, 0, +1},
         { XK_Insert, ShiftMask, "\033[2;2~", 0, 0, 0},
         { XK_Insert, XK_ANY_MOD, "\033[2~", 0, 0, 0},
diff -r 17770cef1d01 -r 0868d5c0a2cd st.c
--- a/st.c Thu Nov 15 16:21:23 2012 +0100
+++ b/st.c Thu Nov 15 16:26:50 2012 +0100
_AT_@ -2100,15 +2100,19 @@
                 sel.bx = -1;
         if(IS_SET(MODE_WRAP) && term.c.state & CURSOR_WRAPNEXT)
                 tnewline(1); /* always go to first col */
- if(IS_SET(MODE_INSERT) && term.c.x+1 < term.col)
+
+ if(IS_SET(MODE_INSERT) && term.c.x+1 < term.col) {
                 memmove(&term.line[term.c.y][term.c.x+1],
                         &term.line[term.c.y][term.c.x],
                         (term.col - term.c.x - 1) * sizeof(Glyph));
+ }
+
         tsetchar(c, &term.c.attr, term.c.x, term.c.y);
- if(term.c.x+1 < term.col)
+ if(term.c.x+1 < term.col) {
                 tmoveto(term.c.x+1, term.c.y);
- else
+ } else {
                 term.c.state |= CURSOR_WRAPNEXT;
+ }
 }
 
 int
Received on Thu Nov 15 2012 - 16:28:52 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 15 2012 - 16:36:09 CET