sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 270090df88dbda257d7636a791b308a1a31b5079
parent 90356d240bb795005e47d30f11a183c6d091a9cb
Author: Fun Maker <funmaker95@gmail.com>
Date:   Thu, 31 Jan 2019 20:02:15 +0100

st scrollback: fixed altscreen detection

Diffstat:
Mst.suckless.org/patches/scrollback/index.md | 3++-
Mst.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-0.8.diff | 66++++++++++++++++++++++++------------------------------------------
Dst.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190106-e23acb9.diff | 82-------------------------------------------------------------------------------
Ast.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190131-e23acb9.diff | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 92 insertions(+), 125 deletions(-)

diff --git a/st.suckless.org/patches/scrollback/index.md b/st.suckless.org/patches/scrollback/index.md @@ -26,7 +26,7 @@ other than scrolling functions.** * [st-scrollback-mouse-altscreen-20170427-5a10aca.diff](st-scrollback-mouse-altscreen-20170427-5a10aca.diff) * [st-scrollback-mouse-altscreen-0.8.diff](st-scrollback-mouse-altscreen-0.8.diff) -* [st-scrollback-mouse-altscreen-20190106-e23acb9.diff](st-scrollback-mouse-altscreen-20190106-e23acb9.diff) +* [st-scrollback-mouse-altscreen-20190131-e23acb9.diff](st-scrollback-mouse-altscreen-20190131-e23acb9.diff) Notes ----- @@ -46,3 +46,4 @@ Authors when using the auto altscreen scrolling) * Lorenzo Bracco - <devtry@riseup.net> (update base patch, use static variable for config) +* Kamil Kleban - <funmaker95@gmail.com> (fix altscreen detection) diff --git a/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-0.8.diff b/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-0.8.diff @@ -14,54 +14,38 @@ index feec7e2..f1a9768 100644 /* Internal keyboard shortcuts. */ diff --git a/st.c b/st.c -index 1d8c12a..f226625 100644 +index 1d8c12a..458dcfa 100644 --- a/st.c +++ b/st.c -@@ -47,17 +47,6 @@ - /* constants */ - #define ISO14755CMD "dmenu -w \"$WINDOWID\" -p codepoint: </dev/null" +@@ -1051,6 +1051,11 @@ tnew(int col, int row) + treset(); + } --enum term_mode { -- MODE_WRAP = 1 << 0, -- MODE_INSERT = 1 << 1, -- MODE_ALTSCREEN = 1 << 2, -- MODE_CRLF = 1 << 3, -- MODE_ECHO = 1 << 4, -- MODE_PRINT = 1 << 5, -- MODE_UTF8 = 1 << 6, -- MODE_SIXEL = 1 << 7, --}; -- - enum cursor_movement { - CURSOR_SAVE, - CURSOR_LOAD ++int tisaltscr(void) ++{ ++ return IS_SET(MODE_ALTSCREEN); ++} ++ + void + tswapscreen(void) + { diff --git a/st.h b/st.h -index cdd25ae..bb6dad4 100644 +index cdd25ae..e6143f0 100644 --- a/st.h +++ b/st.h -@@ -25,6 +25,17 @@ - #define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \ - + HISTSIZE + 1) % HISTSIZE] : term.line[(y) - term.scr]) +@@ -99,6 +99,7 @@ void sendbreak(const Arg *); + void toggleprinter(const Arg *); -+enum term_mode { -+ MODE_WRAP = 1 << 0, -+ MODE_INSERT = 1 << 1, -+ MODE_ALTSCREEN = 1 << 2, -+ MODE_CRLF = 1 << 3, -+ MODE_ECHO = 1 << 4, -+ MODE_PRINT = 1 << 5, -+ MODE_UTF8 = 1 << 6, -+ MODE_SIXEL = 1 << 7, -+}; -+ - enum glyph_attribute { - ATTR_NULL = 0, - ATTR_BOLD = 1 << 0, + int tattrset(int); ++int tisaltscr(void); + void tnew(int, int); + void tresize(int, int); + void tsetdirtattr(int); diff --git a/x.c b/x.c -index 1de5f6c..d3f869e 100644 +index 1de5f6c..991bc3e 100644 --- a/x.c +++ b/x.c -@@ -417,13 +417,14 @@ bpress(XEvent *e) +@@ -417,11 +417,13 @@ bpress(XEvent *e) return; } @@ -70,7 +54,7 @@ index 1de5f6c..d3f869e 100644 - && match(ms->mask, e->xbutton.state)) { - ttywrite(ms->s, strlen(ms->s), 1); - return; -+ if (IS_SET(MODE_ALTSCREEN)) ++ if (tisaltscr()) { + for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { + if (e->xbutton.button == ms->b + && match(ms->mask, e->xbutton.state)) { @@ -78,7 +62,5 @@ index 1de5f6c..d3f869e 100644 + return; + } } -- } + } - for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) { - if (e->xbutton.button == mk->b diff --git a/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190106-e23acb9.diff b/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190106-e23acb9.diff @@ -1,82 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index f770d2e..19d35a7 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -162,8 +162,8 @@ static MouseShortcut mshortcuts[] = { - - MouseKey mkeys[] = { - /* button mask function argument */ -- { Button4, ShiftMask, kscrollup, {.i = 1} }, -- { Button5, ShiftMask, kscrolldown, {.i = 1} }, -+ { Button4, XK_NO_MOD, kscrollup, {.i = 1} }, -+ { Button5, XK_NO_MOD, kscrolldown, {.i = 1} }, - }; - - /* Internal keyboard shortcuts. */ -diff --git a/st.c b/st.c -index 218ae73..3f385a0 100644 ---- a/st.c -+++ b/st.c -@@ -47,17 +47,6 @@ - term.scr + HISTSIZE + 1) % HISTSIZE] : \ - term.line[(y) - term.scr]) - --enum term_mode { -- MODE_WRAP = 1 << 0, -- MODE_INSERT = 1 << 1, -- MODE_ALTSCREEN = 1 << 2, -- MODE_CRLF = 1 << 3, -- MODE_ECHO = 1 << 4, -- MODE_PRINT = 1 << 5, -- MODE_UTF8 = 1 << 6, -- MODE_SIXEL = 1 << 7, --}; -- - enum cursor_movement { - CURSOR_SAVE, - CURSOR_LOAD -diff --git a/st.h b/st.h -index 3592957..1469450 100644 ---- a/st.h -+++ b/st.h -@@ -20,6 +20,17 @@ - #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) - #define IS_TRUECOL(x) (1 << 24 & (x)) - -+enum term_mode { -+ MODE_WRAP = 1 << 0, -+ MODE_INSERT = 1 << 1, -+ MODE_ALTSCREEN = 1 << 2, -+ MODE_CRLF = 1 << 3, -+ MODE_ECHO = 1 << 4, -+ MODE_PRINT = 1 << 5, -+ MODE_UTF8 = 1 << 6, -+ MODE_SIXEL = 1 << 7, -+}; -+ - enum glyph_attribute { - ATTR_NULL = 0, - ATTR_BOLD = 1 << 0, -diff --git a/x.c b/x.c -index e9fd6e9..c914a0b 100644 ---- a/x.c -+++ b/x.c -@@ -417,11 +417,13 @@ bpress(XEvent *e) - return; - } - -- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { -- if (e->xbutton.button == ms->b -- && match(ms->mask, e->xbutton.state)) { -- ttywrite(ms->s, strlen(ms->s), 1); -- return; -+ if (IS_SET(MODE_ALTSCREEN)) { -+ for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { -+ if (e->xbutton.button == ms->b -+ && match(ms->mask, e->xbutton.state)) { -+ ttywrite(ms->s, strlen(ms->s), 1); -+ return; -+ } - } - } - diff --git a/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190131-e23acb9.diff b/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190131-e23acb9.diff @@ -0,0 +1,66 @@ +diff --git a/config.def.h b/config.def.h +index a6d2fb9..16830c8 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -162,8 +162,8 @@ static MouseShortcut mshortcuts[] = { + + MouseKey mkeys[] = { + /* button mask function argument */ +- { Button4, ShiftMask, kscrollup, {.i = 1} }, +- { Button5, ShiftMask, kscrolldown, {.i = 1} }, ++ { Button4, XK_NO_MOD, kscrollup, {.i = 1} }, ++ { Button5, XK_NO_MOD, kscrolldown, {.i = 1} }, + }; + + /* Internal keyboard shortcuts. */ +diff --git a/st.c b/st.c +index 218ae73..f543305 100644 +--- a/st.c ++++ b/st.c +@@ -1058,6 +1058,11 @@ tnew(int col, int row) + treset(); + } + ++int tisaltscr(void) ++{ ++ return IS_SET(MODE_ALTSCREEN); ++} ++ + void + tswapscreen(void) + { +diff --git a/st.h b/st.h +index 3592957..23f4ca3 100644 +--- a/st.h ++++ b/st.h +@@ -95,6 +95,7 @@ void sendbreak(const Arg *); + void toggleprinter(const Arg *); + + int tattrset(int); ++int tisaltscr(void); + void tnew(int, int); + void tresize(int, int); + void tsetdirtattr(int); +diff --git a/x.c b/x.c +index e9fd6e9..2dc315e 100644 +--- a/x.c ++++ b/x.c +@@ -417,11 +417,13 @@ bpress(XEvent *e) + return; + } + +- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { +- if (e->xbutton.button == ms->b +- && match(ms->mask, e->xbutton.state)) { +- ttywrite(ms->s, strlen(ms->s), 1); +- return; ++ if (tisaltscr()) { ++ for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { ++ if (e->xbutton.button == ms->b ++ && match(ms->mask, e->xbutton.state)) { ++ ttywrite(ms->s, strlen(ms->s), 1); ++ return; ++ } + } + } +