scroll

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

commit 3223bbd5d8697e4ef74db82580e4675acf14666f
parent d32eb919fc093507c514ffbb4c70b6eba3f251ae
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Thu,  2 Apr 2020 21:52:18 +0200

make event strings editable in config.h

Diffstat:
MMakefile | 5+++++
Aconfig.def.h | 2++
Mscroll.c | 6++++--
3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -6,6 +6,11 @@ all: scroll clean: rm -f scroll ptty +config.h: + cp config.def.h config.h + +scroll: scroll.c config.h + install: scroll cp scroll ${BINDIR} cp scroll.1 ${MAN1DIR} diff --git a/config.def.h b/config.def.h @@ -0,0 +1,2 @@ +#define SCROLL_UP "\033[5;2~" +#define SCROLL_DOWN "\033[6;2~" diff --git a/scroll.c b/scroll.c @@ -43,6 +43,8 @@ #include <libutil.h> #endif +#include "config.h" + TAILQ_HEAD(tailhead, line) head; struct line { @@ -388,9 +390,9 @@ main(int argc, char *argv[]) if (n <= 0 && errno != EINTR) die("read:"); - if (strncmp("\033[5;2~", input, n) == 0) + if (strncmp(SCROLL_UP, input, n) == 0) scrollup(); - else if (strncmp("\033[6;2~", input, n) == 0) + else if (strncmp(SCROLL_DOWN, input, n) == 0) scrolldown(buf, pos); else if (write(mfd, input, n) == -1) die("write:");