summaryrefslogtreecommitdiff
path: root/st/st-0.9.3/x.c
diff options
context:
space:
mode:
authorThomas Ulmer <thomasmulmer02@gmail.com>2025-12-20 15:19:13 -0800
committerThomas Ulmer <thomasmulmer02@gmail.com>2025-12-20 15:19:13 -0800
commitb4a9f5445d2a5d66f3f209dce4d9b657ee8f7e75 (patch)
tree2b19105237e41974abb3012a7aca78968327f94e /st/st-0.9.3/x.c
parent945cec5b117509e219edd8c321884c6c15751a92 (diff)
st: scrollback with Shift+Pg{up,down} and mouse, keyboard select
Diffstat (limited to 'st/st-0.9.3/x.c')
-rw-r--r--st/st-0.9.3/x.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/st/st-0.9.3/x.c b/st/st-0.9.3/x.c
index 1e4bdf5..da3d8ac 100644
--- a/st/st-0.9.3/x.c
+++ b/st/st-0.9.3/x.c
@@ -34,6 +34,7 @@ typedef struct {
void (*func)(const Arg *);
const Arg arg;
uint release;
+ int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */
} MouseShortcut;
typedef struct {
@@ -59,8 +60,6 @@ static void zoom(const Arg *);
static void zoomabs(const Arg *);
static void zoomreset(const Arg *);
static void ttysend(const Arg *);
-void kscrollup(const Arg *);
-void kscrolldown(const Arg *);
/* config.h for applying patches and the configuration. */
#include "config.h"
@@ -457,6 +456,7 @@ mouseaction(XEvent *e, uint release)
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
if (ms->release == release &&
ms->button == e->xbutton.button &&
+ (!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) &&
(match(ms->mod, state) || /* exact or forced */
match(ms->mod, state & ~forcemousemod))) {
ms->func(&(ms->arg));
@@ -1861,6 +1861,14 @@ kpress(XEvent *ev)
} else {
len = XLookupString(e, buf, sizeof buf, &ksym, NULL);
}
+
+ if ( IS_SET(MODE_KBDSELECT) ) {
+ if ( match(XK_NO_MOD, e->state) ||
+ (XK_Shift_L | XK_Shift_R) & e->state )
+ win.mode ^= trt_kbdselect(ksym, buf, len);
+ return;
+ }
+
/* 1. shortcuts */
for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
if (ksym == bp->keysym && match(bp->mod, e->state)) {
@@ -2038,6 +2046,14 @@ usage(void)
" [stty_args ...]\n", argv0, argv0);
}
+void toggle_winmode(int flag) {
+ win.mode ^= flag;
+}
+
+void keyboard_select(const Arg *dummy) {
+ win.mode ^= trt_kbdselect(-1, NULL, 0);
+}
+
int
main(int argc, char *argv[])
{