scroll

scrollbackbuffer program for st
git clone git://git.suckless.org//gitrepos
Log | Files | Refs

commit 94da2d2b15ecb4274f2ac2da91807c56743b15a8
parent 3223bbd5d8697e4ef74db82580e4675acf14666f
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Thu,  2 Apr 2020 22:20:33 +0200

add second esc seq. string for mouse events

Diffstat:
Mconfig.def.h | 11+++++++++--
Mscroll.c | 6++++--
2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -1,2 +1,9 @@ -#define SCROLL_UP "\033[5;2~" -#define SCROLL_DOWN "\033[6;2~" +/* + * Define ESC seqences to use for scroll events. + * Use "cat -v" to figure out favorit key combination. + */ +#define KB_SCROLL_UP "\033[5;2~" /* [Shift] + [PageUP] */ +#define KB_SCROLL_DOWN "\033[6;2~" /* [Shift] + [PageDown] */ + +#define MS_SCROLL_UP "\031" /* mouse wheel up */ +#define MS_SCROLL_DOWN "\005" /* mouse wheel Down */ diff --git a/scroll.c b/scroll.c @@ -390,9 +390,11 @@ main(int argc, char *argv[]) if (n <= 0 && errno != EINTR) die("read:"); - if (strncmp(SCROLL_UP, input, n) == 0) + if (strncmp(KB_SCROLL_UP, input, n) == 0 || + strncmp(MS_SCROLL_UP, input, n) == 0) scrollup(); - else if (strncmp(SCROLL_DOWN, input, n) == 0) + else if (strncmp(KB_SCROLL_DOWN, input, n) == 0 || + strncmp(MS_SCROLL_DOWN, input, n) == 0) scrolldown(buf, pos); else if (write(mfd, input, n) == -1) die("write:");