["\'`])|(?\[)|(?\())'; -+ -+ $matcher = generate_matcher('.*?'); -+ -+ # Here we match text till enclosing pair, using perl conditionals in -+ # regexps (?(condition)yes-expression|no-expression). -+ # \0 is used to hack concatenation with '*' later in the code. -+ $char_class_at_end = '.*?(.(?=(?()\]|((?(
)\)|\g{q})))))\0'; -+ $char_class_to_complete = '\S'; -+} -+ -+ -+# use the last used word or read the word behind the cursor -+my $word_to_complete = read_word_at_coord($self, $cursor_row, $cursor_column, -+ $char_class_to_complete); -+ -+print stdout "$word_to_complete\n"; -+ -+if ($word_to_complete) { -+ while (1) { -+ # ignore the completed word itself -+ $self->{already_completed}{$word_to_complete} = 1; -+ -+ # continue the last search or start from the current row -+ my $completion = find_match($self, -+ $word_to_complete, -+ $self->{next_row} // $cursor_row, -+ $matcher->($word_to_complete), -+ $char_class_before, -+ $char_class_at_end); -+ if ($completion) { -+ print stdout $completion."\n".join ("\n", @{$self->{highlight}})."\n"; -+ } -+ else { -+ last; -+ } -+ } -+} -+ -+###################################################################### -+ -+sub highlight_match { -+ my ($self, $linenum, $completion) = @_; -+ -+ # clear_highlight($self); -+ -+ my $line = @{$lines}[$linenum]; -+ my $re = quotemeta $completion; -+ -+ $line =~ /$re/; -+ -+ my $beg = $-[0]; -+ my $end = $+[0]; -+ -+ if ($linenum >= $lines_before_cursor) -+ { -+ $lline = $last_line - $lines_before_cursor; -+ $linenum -= $lines_before_cursor; -+ $linenum = $lline - $linenum; -+ $linenum += $lines_before_cursor; -+ } -+ -+ -+ $self->{highlight} = [$linenum, $beg, $end]; -+} -+ -+###################################################################### -+ -+sub read_word_at_coord { -+ my ($self, $row, $col, $char_class) = @_; -+ -+ $_ = substr(@{$lines} [$row], 0, $col); # get the current line up to the cursor... -+ s/.*?($char_class*)$/$1/; # ...and read the last word from it -+ return $_; -+} -+ -+###################################################################### -+ -+# Returns a function that takes a string and returns that string with -+# this function's argument inserted between its every two characters. -+# The resulting string is used as a regular expression matching the -+# completion candidates. -+sub generate_matcher { -+ my $regex_between = shift; -+ -+ sub { -+ $_ = shift; -+ -+ # sorry for this lispy code, I couldn't resist ;) -+ (join "$regex_between", -+ (map quotemeta, -+ (split //))) -+ } -+} -+ -+###################################################################### -+ -+# Checks whether the completion found by find_match() was already -+# found and if it was, calls find_match() again to find the next -+# completion. -+# -+# Takes all the arguments that find_match() would take, to make a -+# mutually recursive call. -+sub skip_duplicates { -+ my ($self, $word_to_match, $current_row, $regexp, $char_class_before, $char_class_at_end) = @_; -+ my $completion; -+ -+ if ($current_row <= $lines_before_cursor) -+ { -+ $completion = shift @{$self->{matches_in_row}}; # get the leftmost one -+ } -+ else -+ { -+ $completion = pop @{$self->{matches_in_row}}; # get the leftmost one -+ } -+ -+ # check for duplicates -+ if (exists $self->{already_completed}{$completion}) { -+ # skip this completion -+ return find_match(@_); -+ } else { -+ $self->{already_completed}{$completion} = 1; -+ -+ highlight_match($self, -+ $self->{next_row}+1, -+ $completion); -+ -+ return $completion; -+ } -+} -+ -+###################################################################### -+ -+# Finds the next matching completion in the row current row or above -+# while skipping duplicates using skip_duplicates(). -+sub find_match { -+ my ($self, $word_to_match, $current_row, $regexp, $char_class_before, $char_class_at_end) = @_; -+ $self->{matches_in_row} //= []; -+ -+ # cycle through all the matches in the current row if not starting a new search -+ if (@{$self->{matches_in_row}}) { -+ return skip_duplicates($self, $word_to_match, $current_row, $regexp, $char_class_before, $char_class_at_end); -+ } -+ -+ -+ my $i; -+ # search through all the rows starting with current one or one above the last checked -+ for ($i = $current_row; $i >= 0; --$i) { -+ my $line = @{$lines}[$i]; # get the line of text from the row -+ -+ # if ($i == $cursor_row) { -+ # $line = substr $line, 0, $cursor_column; -+ # } -+ -+ $_ = $line; -+ -+ # find all the matches in the current line -+ my $match; -+ push @{$self->{matches_in_row}}, $+{match} while ($_, $match) = / -+ (.*${char_class_before}) -+ (?
-+ ${regexp} -+ ${char_class_at_end}* -+ ) -+ /ix; -+ # corner case: match at the very beginning of line -+ push @{$self->{matches_in_row}}, $+{match} if $line =~ /^(${char_class_before}){0}(? $regexp$char_class_at_end*)/i; -+ -+ if (@{$self->{matches_in_row}}) { -+ # remember which row should be searched next -+ $self->{next_row} = --$i; -+ -+ # arguments needed for find_match() mutual recursion -+ return skip_duplicates($self, $word_to_match, $i, $regexp, $char_class_before, $char_class_at_end); -+ } -+ } -+ -+ # # no more possible completions, revert to the original word -+ # undo_completion($self) if $i < 0; -+ -+ return undef; -+} -diff -uraN st-0.8.5/st.c st-autocomplete/st.c ---- st-0.8.5/st.c 2022-03-13 02:45:34.586842452 +0400 -+++ st-autocomplete/st.c 2022-03-27 22:28:39.041693478 +0400 -@@ -17,6 +17,7 @@ - #include - #include - -+#include "autocomplete.h" - #include "st.h" - #include "win.h" - -@@ -2569,6 +2570,8 @@ - return; - } - -+ autocomplete ((const Arg []) { ACMPL_DEACTIVATE }); -+ - /* - * slide screen to keep cursor where we expect it - - * tscrollup would work here, but we can optimize to -@@ -2688,3 +2691,256 @@ - tfulldirt(); - draw(); - } -+ -+void autocomplete (const Arg * arg) -+{ -+ static _Bool active = 0; -+ -+ int acmpl_cmdindex = arg -> i; -+ -+ static int acmpl_cmdindex_prev; -+ -+ if (active == 0) -+ acmpl_cmdindex_prev = acmpl_cmdindex; -+ -+ static const char * const (acmpl_cmd []) = { -+ [ACMPL_DEACTIVATE] = "__DEACTIVATE__", -+ [ACMPL_WORD] = "word-complete", -+ [ACMPL_WWORD] = "WORD-complete", -+ [ACMPL_FUZZY_WORD] = "fuzzy-word-complete", -+ [ACMPL_FUZZY_WWORD] = "fuzzy-WORD-complete", -+ [ACMPL_FUZZY] = "fuzzy-complete", -+ [ACMPL_SUFFIX] = "suffix-complete", -+ [ACMPL_SURROUND] = "surround-complete", -+ [ACMPL_UNDO] = "__UNDO__", -+ }; -+ -+ static char acmpl [1000]; // ACMPL_ISSUE: why 1000? -+ -+ static FILE * acmpl_exec = NULL; -+ static int acmpl_status; -+ -+ static const char * stbuffile; -+ static char target [1000]; // ACMPL_ISSUE: why 1000? dynamically allocate char array of size term.col -+ static size_t targetlen; -+ -+ static char completion [1000] = {0}; // ACMPL_ISSUE: why 1000? dynamically allocate char array of size term.col -+ static size_t complen_prev = 0; // NOTE: always clear this variable after clearing completion -+ -+ static int cx, cy; -+ -+ // ACMPL_ISSUE: crashes when term.row is too small -+ -+// Check for deactivation -+ -+ if (acmpl_cmdindex == ACMPL_DEACTIVATE) -+ { -+ -+// Deactivate autocomplete mode keeping current completion -+ -+ if (active) -+ { -+ active = 0; -+ pclose (acmpl_exec); -+ remove (stbuffile); -+ -+ if (complen_prev) -+ { -+ selclear (); -+ complen_prev = 0; -+ } -+ } -+ -+ return; -+ } -+ -+// Check for undo -+ -+ if (acmpl_cmdindex == ACMPL_UNDO) -+ { -+ -+// Deactivate autocomplete mode recovering target -+ -+ if (active) -+ { -+ active = 0; -+ pclose (acmpl_exec); -+ remove (stbuffile); -+ -+ if (complen_prev) -+ { -+ selclear (); -+ for (size_t i = 0; i < complen_prev; i++) -+ ttywrite ((char []) { '\b' }, 1, 1); // ACMPL_ISSUE: I'm not sure that this is the right way -+ complen_prev = 0; -+ ttywrite (target, targetlen, 0); // ACMPL_ISSUE: I'm not sure that this is a right solution -+ } -+ } -+ -+ return; -+ } -+ -+// Check for command change -+ -+ if (acmpl_cmdindex != acmpl_cmdindex_prev) -+ { -+ -+// If command is changed, goto acmpl_begin avoiding rewriting st buffer -+ -+ if (active) -+ { -+ acmpl_cmdindex_prev = acmpl_cmdindex; -+ -+ goto acmpl_begin; -+ } -+ } -+ -+// If not active -+ -+ if (active == 0) -+ { -+ acmpl_cmdindex_prev = acmpl_cmdindex; -+ cx = term.c.x; -+ cy = term.c.y; -+ -+// Write st buffer to a temp file -+ -+ stbuffile = tmpnam (NULL); // ACMPL_ISSUE: check for return value ... -+ // ACMPL_ISSUE: use coprocesses instead of temp files -+ -+ FILE * stbuf = fopen (stbuffile, "w"); // ACMPL_ISSUE: check for opening error ... -+ char * stbufline = malloc (term.col + 2); // ACMPL_ISSUE: check for allocating error ... -+ -+ int cxp = 0; -+ -+ for (size_t y = 0; y < term.row; y++) -+ { -+ if (y == term.c.y) cx += cxp * term.col; -+ -+ size_t x = 0; -+ for (; x < term.col; x++) -+ utf8encode (term.line [y] [x].u, stbufline + x); -+ if (term.line [y] [x - 1].mode & ATTR_WRAP) -+ { -+ x--; -+ if (y <= term.c.y) cy--; -+ cxp++; -+ } -+ else -+ { -+ stbufline [x] = '\n'; -+ cxp = 0; -+ } -+ stbufline [x + 1] = 0; -+ fputs (stbufline, stbuf); -+ } -+ -+ free (stbufline); -+ fclose (stbuf); -+ -+acmpl_begin: -+ -+// Run st-autocomplete -+ -+ sprintf ( -+ acmpl, -+ "cat %100s | st-autocomplete %500s %d %d", // ACMPL_ISSUE: why 100 and 500? -+ stbuffile, -+ acmpl_cmd [acmpl_cmdindex], -+ cy, -+ cx -+ ); -+ -+ acmpl_exec = popen (acmpl, "r"); // ACMPL_ISSUE: popen isn't defined by The Standard. Does it work in BSDs for example? -+ // ACMPL_ISSUE: check for popen error ... -+ -+// Read the target, targetlen -+ -+ fscanf (acmpl_exec, "%500s\n", target); // ACMPL_ISSUE: check for scanning error ... -+ targetlen = strlen (target); -+ } -+ -+// Read a completion if exists (acmpl_status) -+ -+ unsigned line, beg, end; -+ -+ acmpl_status = fscanf (acmpl_exec, "%500[^\n]\n%u\n%u\n%u\n", completion, & line, & beg, & end); -+ // ACMPL_ISSUE: why 500? use term.col instead -+ -+// Exit if no completions found -+ -+ if (active == 0 && acmpl_status == EOF) -+ { -+ -+// Close st-autocomplete and exit without activating the autocomplete mode -+ -+ pclose (acmpl_exec); -+ remove (stbuffile); -+ return; -+ } -+ -+// If completions found, enable autocomplete mode and autocomplete the target -+ -+ active = 1; -+ -+// Clear target before first completion -+ -+ if (complen_prev == 0) -+ { -+ for (size_t i = 0; i < targetlen; i++) -+ ttywrite ((char []) { '\b' }, 1, 1); // ACMPL_ISSUE: I'm not sure that this is a right solution -+ } -+ -+// Clear previuos completion if this is not the first -+ -+ else -+ { -+ selclear (); -+ for (size_t i = 0; i < complen_prev; i++) -+ ttywrite ((char []) { '\b' }, 1, 1); // ACMPL_ISSUE: I'm not sure that this is a right solution -+ complen_prev = 0; -+ } -+ -+// If no more completions found, reset and restart -+ -+ if (acmpl_status == EOF) -+ { -+ active = 0; -+ pclose (acmpl_exec); -+ ttywrite (target, targetlen, 0); -+ goto acmpl_begin; -+ } -+ -+// Count wrapped lines before the current line -+ -+ int wl = 0; -+ -+ int tl = line; -+ -+ for (int l = 0; l < tl; l++) -+ if (term.line [l] [term.col - 1].mode & ATTR_WRAP) -+ { -+ wl++; -+ tl++; -+ } -+ -+// Autcomplete -+ -+ complen_prev = strlen (completion); -+ ttywrite (completion, complen_prev, 0); -+ -+ if (line == cy && beg > cx) -+ { -+ beg += complen_prev - targetlen; -+ end += complen_prev - targetlen; -+ -+ // ACMPL_ISSUE: highlignthing doesn't work when "line == cy && beg > cx", -+ // but coordinates are correct... -+ } -+ -+ end--; -+ -+ selstart (beg % term.col, line + wl + beg / term.col, 0); -+ selextend (end % term.col, line + wl + end / term.col, 1, 0); -+ xsetsel (getsel ()); -+} -diff -uraN st-0.8.5/st.h st-autocomplete/st.h ---- st-0.8.5/st.h 2022-03-13 02:45:34.586842452 +0400 -+++ st-autocomplete/st.h 2022-03-13 02:45:34.586842452 +0400 -@@ -77,6 +77,8 @@ - const char *s; - } Arg; - -+void autocomplete (const Arg *); -+ - void die(const char *, ...); - void redraw(void); - void draw(void); -diff -uraN st-0.8.5/x.c st-autocomplete/x.c ---- st-0.8.5/x.c 2022-03-13 02:45:34.586842452 +0400 -+++ st-autocomplete/x.c 2022-03-13 02:45:34.590175835 +0400 -@@ -1834,11 +1834,20 @@ - /* 1. shortcuts */ - for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) { - if (ksym == bp->keysym && match(bp->mod, e->state)) { -+ if (bp -> func != autocomplete) -+ autocomplete ((const Arg []) { ACMPL_DEACTIVATE }); - bp->func(&(bp->arg)); - return; - } - } - -+ if (!( -+ len == 0 && -+ e -> state & ~ignoremod // ACMPL_ISSUE: I'm not sure that this is the right way -+ | ACMPL_MOD == ACMPL_MOD -+ )) -+ autocomplete ((const Arg []) { ACMPL_DEACTIVATE }); -+ - /* 2. custom keys from config.h */ - if ((customkey = kmap(ksym, e->state))) { - ttywrite(customkey, strlen(customkey), 1); diff --git a/gentoo_portage/patches/x11-terms/st/st-alpha-20220206-0.8.5.diff b/gentoo_portage/patches/x11-terms/st/st-alpha-20240814-a0274bc.diff similarity index 52% rename from gentoo_portage/patches/x11-terms/st/st-alpha-20220206-0.8.5.diff rename to gentoo_portage/patches/x11-terms/st/st-alpha-20240814-a0274bc.diff index ab029f6..6913d19 100644 --- a/gentoo_portage/patches/x11-terms/st/st-alpha-20220206-0.8.5.diff +++ b/gentoo_portage/patches/x11-terms/st/st-alpha-20240814-a0274bc.diff @@ -1,5 +1,5 @@ diff --git a/config.def.h b/config.def.h -index 91ab8ca..6af616e 100644 +index 2cd740a..019a4e1 100644 --- a/config.def.h +++ b/config.def.h @@ -93,6 +93,9 @@ char *termname = "st-256color"; @@ -12,30 +12,8 @@ index 91ab8ca..6af616e 100644 /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { /* 8 normal colors */ -diff --git a/config.mk b/config.mk -index 4c4c5d5..0114bad 100644 ---- a/config.mk -+++ b/config.mk -@@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config - INCS = -I$(X11INC) \ - `$(PKG_CONFIG) --cflags fontconfig` \ - `$(PKG_CONFIG) --cflags freetype2` --LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ -+LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\ - `$(PKG_CONFIG) --libs fontconfig` \ - `$(PKG_CONFIG) --libs freetype2` - -diff --git a/st.h b/st.h -index 519b9bd..8bb533d 100644 ---- a/st.h -+++ b/st.h -@@ -126,3 +126,4 @@ extern unsigned int tabspaces; - extern unsigned int defaultfg; - extern unsigned int defaultbg; - extern unsigned int defaultcs; -+extern float alpha; diff --git a/x.c b/x.c -index 8a16faa..ddf4178 100644 +index d73152b..f32fd6c 100644 --- a/x.c +++ b/x.c @@ -105,6 +105,7 @@ typedef struct { @@ -46,15 +24,7 @@ index 8a16faa..ddf4178 100644 int l, t; /* left and top offset */ int gm; /* geometry mask */ } XWindow; -@@ -243,6 +244,7 @@ static char *usedfont = NULL; - static double usedfontsize = 0; - static double defaultfontsize = 0; - -+static char *opt_alpha = NULL; - static char *opt_class = NULL; - static char **opt_cmd = NULL; - static char *opt_embed = NULL; -@@ -736,7 +738,7 @@ xresize(int col, int row) +@@ -752,7 +753,7 @@ xresize(int col, int row) XFreePixmap(xw.dpy, xw.buf); xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, @@ -63,22 +33,32 @@ index 8a16faa..ddf4178 100644 XftDrawChange(xw.draw, xw.buf); xclear(0, 0, win.w, win.h); -@@ -796,6 +798,13 @@ xloadcols(void) +@@ -812,6 +813,10 @@ xloadcols(void) else die("could not allocate color %d\n", i); } + -+ /* set alpha value of bg color */ -+ if (opt_alpha) -+ alpha = strtof(opt_alpha, NULL); + dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); + dc.col[defaultbg].pixel &= 0x00FFFFFF; + dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; loaded = 1; } -@@ -1118,11 +1127,23 @@ xinit(int cols, int rows) - Window parent; +@@ -842,6 +847,12 @@ xsetcolorname(int x, const char *name) + XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[x]); + dc.col[x] = ncolor; + ++ if (x == defaultbg) { ++ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); ++ dc.col[defaultbg].pixel &= 0x00FFFFFF; ++ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; ++ } ++ + return 0; + } + +@@ -1134,11 +1145,25 @@ xinit(int cols, int rows) + Window parent, root; pid_t thispid = getpid(); XColor xmousefg, xmousebg; + XWindowAttributes attr; @@ -89,20 +69,22 @@ index 8a16faa..ddf4178 100644 xw.scr = XDefaultScreen(xw.dpy); - xw.vis = XDefaultVisual(xw.dpy, xw.scr); + -+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { -+ parent = XRootWindow(xw.dpy, xw.scr); -+ xw.depth = 32; ++ root = XRootWindow(xw.dpy, xw.scr); ++ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) ++ parent = root; ++ ++ if (XMatchVisualInfo(xw.dpy, xw.scr, 32, TrueColor, &vis) != 0) { ++ xw.vis = vis.visual; ++ xw.depth = vis.depth; + } else { + XGetWindowAttributes(xw.dpy, parent, &attr); ++ xw.vis = attr.visual; + xw.depth = attr.depth; + } -+ -+ XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis); -+ xw.vis = vis.visual; /* font */ if (!FcInit()) -@@ -1132,7 +1153,7 @@ xinit(int cols, int rows) +@@ -1148,7 +1173,7 @@ xinit(int cols, int rows) xloadfonts(usedfont, 0); /* colors */ @@ -111,35 +93,36 @@ index 8a16faa..ddf4178 100644 xloadcols(); /* adjust fixed window geometry */ -@@ -1152,19 +1173,15 @@ xinit(int cols, int rows) +@@ -1168,11 +1193,8 @@ xinit(int cols, int rows) | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; xw.attrs.colormap = xw.cmap; +- root = XRootWindow(xw.dpy, xw.scr); - if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) -- parent = XRootWindow(xw.dpy, xw.scr); - xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, +- parent = root; +- xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t, - win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, ++ xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, + win.w, win.h, 0, xw.depth, InputOutput, xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask | CWColormap, &xw.attrs); - - memset(&gcvalues, 0, sizeof(gcvalues)); - gcvalues.graphics_exposures = False; -- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, -- &gcvalues); -- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, + if (parent != root) +@@ -1183,7 +1205,7 @@ xinit(int cols, int rows) + dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures, + &gcvalues); + xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, - DefaultDepth(xw.dpy, xw.scr)); -+ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); -+ dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); ++ xw.depth); XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); -@@ -2019,6 +2036,9 @@ main(int argc, char *argv[]) +@@ -2047,6 +2069,10 @@ main(int argc, char *argv[]) case 'a': allowaltscreen = 0; break; + case 'A': -+ opt_alpha = EARGF(usage()); ++ alpha = strtof(EARGF(usage()), NULL); ++ LIMIT(alpha, 0.0, 1.0); + break; case 'c': opt_class = EARGF(usage()); diff --git a/gentoo_portage/patches/x11-terms/st/st-scrollback-20210507-4536f46.diff b/gentoo_portage/patches/x11-terms/st/st-scrollback-0.9.2.diff similarity index 86% rename from gentoo_portage/patches/x11-terms/st/st-scrollback-20210507-4536f46.diff rename to gentoo_portage/patches/x11-terms/st/st-scrollback-0.9.2.diff index f960f6b..f9782e8 100644 --- a/gentoo_portage/patches/x11-terms/st/st-scrollback-20210507-4536f46.diff +++ b/gentoo_portage/patches/x11-terms/st/st-scrollback-0.9.2.diff @@ -1,18 +1,18 @@ diff --git a/config.def.h b/config.def.h -index 6f05dce..93cbcc0 100644 +index 2cd740a..40b7d93 100644 --- a/config.def.h +++ b/config.def.h -@@ -199,6 +199,8 @@ static Shortcut shortcuts[] = { +@@ -201,6 +201,8 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Y, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, + { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, -+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, ++ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, }; /* diff --git a/st.c b/st.c -index ebdf360..817cc47 100644 +index b9f66e7..2478942 100644 --- a/st.c +++ b/st.c @@ -35,6 +35,7 @@ @@ -28,8 +28,8 @@ index ebdf360..817cc47 100644 #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c)) #define ISDELIM(u) (u && wcschr(worddelimiters, u)) +#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \ -+ term.scr + HISTSIZE + 1) % HISTSIZE] : \ -+ term.line[(y) - term.scr]) ++ term.scr + HISTSIZE + 1) % HISTSIZE] : \ ++ term.line[(y) - term.scr]) enum term_mode { MODE_WRAP = 1 << 0, @@ -43,7 +43,7 @@ index ebdf360..817cc47 100644 int *dirty; /* dirtyness of lines */ TCursor c; /* cursor */ int ocx; /* old cursor col */ -@@ -184,8 +191,8 @@ static void tnewline(int); +@@ -185,8 +192,8 @@ static void tnewline(int); static void tputtab(int); static void tputc(Rune); static void treset(void); @@ -54,7 +54,7 @@ index ebdf360..817cc47 100644 static void tsetattr(const int *, int); static void tsetchar(Rune, const Glyph *, int, int); static void tsetdirt(int, int); -@@ -416,10 +423,10 @@ tlinelen(int y) +@@ -409,10 +416,10 @@ tlinelen(int y) { int i = term.col; @@ -67,7 +67,7 @@ index ebdf360..817cc47 100644 --i; return i; -@@ -528,7 +535,7 @@ selsnap(int *x, int *y, int direction) +@@ -521,7 +528,7 @@ selsnap(int *x, int *y, int direction) * Snap around if the word wraps around at the end or * beginning of a line. */ @@ -76,7 +76,7 @@ index ebdf360..817cc47 100644 prevdelim = ISDELIM(prevgp->u); for (;;) { newx = *x + direction; -@@ -543,14 +550,14 @@ selsnap(int *x, int *y, int direction) +@@ -536,14 +543,14 @@ selsnap(int *x, int *y, int direction) yt = *y, xt = *x; else yt = newy, xt = newx; @@ -93,7 +93,7 @@ index ebdf360..817cc47 100644 delim = ISDELIM(gp->u); if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim || (delim && gp->u != prevgp->u))) -@@ -571,14 +578,14 @@ selsnap(int *x, int *y, int direction) +@@ -564,14 +571,14 @@ selsnap(int *x, int *y, int direction) *x = (direction < 0) ? 0 : term.col - 1; if (direction < 0) { for (; *y > 0; *y += direction) { @@ -110,7 +110,7 @@ index ebdf360..817cc47 100644 & ATTR_WRAP)) { break; } -@@ -609,13 +616,13 @@ getsel(void) +@@ -602,13 +609,13 @@ getsel(void) } if (sel.type == SEL_RECTANGULAR) { @@ -127,7 +127,7 @@ index ebdf360..817cc47 100644 while (last >= gp && last->u == ' ') --last; -@@ -850,6 +857,9 @@ void +@@ -844,6 +851,9 @@ void ttywrite(const char *s, size_t n, int may_echo) { const char *next; @@ -137,7 +137,7 @@ index ebdf360..817cc47 100644 if (may_echo && IS_SET(MODE_ECHO)) twrite(s, n, 1); -@@ -1061,13 +1071,53 @@ tswapscreen(void) +@@ -1055,13 +1065,53 @@ tswapscreen(void) } void @@ -192,7 +192,7 @@ index ebdf360..817cc47 100644 tsetdirt(orig, term.bot-n); tclearregion(0, term.bot-n+1, term.col-1, term.bot); -@@ -1077,17 +1127,28 @@ tscrolldown(int orig, int n) +@@ -1071,17 +1121,28 @@ tscrolldown(int orig, int n) term.line[i-n] = temp; } @@ -223,7 +223,7 @@ index ebdf360..817cc47 100644 tclearregion(0, orig, term.col-1, orig+n-1); tsetdirt(orig+n, term.bot); -@@ -1097,7 +1158,8 @@ tscrollup(int orig, int n) +@@ -1091,7 +1152,8 @@ tscrollup(int orig, int n) term.line[i+n] = temp; } @@ -233,7 +233,7 @@ index ebdf360..817cc47 100644 } void -@@ -1126,7 +1188,7 @@ tnewline(int first_col) +@@ -1120,7 +1182,7 @@ tnewline(int first_col) int y = term.c.y; if (y == term.bot) { @@ -242,7 +242,7 @@ index ebdf360..817cc47 100644 } else { y++; } -@@ -1291,14 +1353,14 @@ void +@@ -1285,14 +1347,14 @@ void tinsertblankline(int n) { if (BETWEEN(term.c.y, term.top, term.bot)) @@ -259,9 +259,9 @@ index ebdf360..817cc47 100644 } int32_t -@@ -1735,11 +1797,11 @@ csihandle(void) - break; +@@ -1730,11 +1792,11 @@ csihandle(void) case 'S': /* SU -- Scroll line up */ + if (csiescseq.priv) break; DEFAULT(csiescseq.arg[0], 1); - tscrollup(term.top, csiescseq.arg[0]); + tscrollup(term.top, csiescseq.arg[0], 0); @@ -273,7 +273,7 @@ index ebdf360..817cc47 100644 break; case 'L': /* IL -- Insert blank lines */ DEFAULT(csiescseq.arg[0], 1); -@@ -2251,7 +2313,7 @@ eschandle(uchar ascii) +@@ -2306,7 +2368,7 @@ eschandle(uchar ascii) return 0; case 'D': /* IND -- Linefeed */ if (term.c.y == term.bot) { @@ -282,7 +282,7 @@ index ebdf360..817cc47 100644 } else { tmoveto(term.c.x, term.c.y+1); } -@@ -2264,7 +2326,7 @@ eschandle(uchar ascii) +@@ -2319,7 +2381,7 @@ eschandle(uchar ascii) break; case 'M': /* RI -- Reverse index */ if (term.c.y == term.top) { @@ -291,7 +291,7 @@ index ebdf360..817cc47 100644 } else { tmoveto(term.c.x, term.c.y-1); } -@@ -2474,7 +2536,7 @@ twrite(const char *buf, int buflen, int show_ctrl) +@@ -2542,7 +2604,7 @@ twrite(const char *buf, int buflen, int show_ctrl) void tresize(int col, int row) { @@ -300,7 +300,7 @@ index ebdf360..817cc47 100644 int minrow = MIN(row, term.row); int mincol = MIN(col, term.col); int *bp; -@@ -2511,6 +2573,14 @@ tresize(int col, int row) +@@ -2579,6 +2641,14 @@ tresize(int col, int row) term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); @@ -315,7 +315,7 @@ index ebdf360..817cc47 100644 /* resize each row to new width, zero-pad if needed */ for (i = 0; i < minrow; i++) { term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); -@@ -2569,7 +2639,7 @@ drawregion(int x1, int y1, int x2, int y2) +@@ -2637,7 +2707,7 @@ drawregion(int x1, int y1, int x2, int y2) continue; term.dirty[y] = 0; @@ -324,7 +324,7 @@ index ebdf360..817cc47 100644 } } -@@ -2590,8 +2660,9 @@ draw(void) +@@ -2658,8 +2728,9 @@ draw(void) cx--; drawregion(0, 0, term.col, term.row); @@ -337,7 +337,7 @@ index ebdf360..817cc47 100644 term.ocy = term.c.y; xfinishdraw(); diff --git a/st.h b/st.h -index fa2eddf..adda2db 100644 +index fd3b0d8..818a6f8 100644 --- a/st.h +++ b/st.h @@ -81,6 +81,8 @@ void die(const char *, ...); diff --git a/gentoo_portage/patches/x11-terms/st/st-scrollback-mouse-20220127-2c5edf2.diff b/gentoo_portage/patches/x11-terms/st/st-scrollback-mouse-0.9.2.diff similarity index 72% rename from gentoo_portage/patches/x11-terms/st/st-scrollback-mouse-20220127-2c5edf2.diff rename to gentoo_portage/patches/x11-terms/st/st-scrollback-mouse-0.9.2.diff index 5c47abc..a956d2b 100644 --- a/gentoo_portage/patches/x11-terms/st/st-scrollback-mouse-20220127-2c5edf2.diff +++ b/gentoo_portage/patches/x11-terms/st/st-scrollback-mouse-0.9.2.diff @@ -1,14 +1,14 @@ -From b5d3351a21442a842e01e8c0317603b6890b379c Mon Sep 17 00:00:00 2001 -From: asparagii -Date: Thu, 27 Jan 2022 15:44:02 +0100 -Subject: [PATCH] st-scrollback-mouse +From 6b7e7e6c5c44dd6347ad49691b80d808c1b0cb77 Mon Sep 17 00:00:00 2001 +From: Jernej Jakob +Date: Mon, 1 Jul 2024 14:00:02 +0200 +Subject: [PATCH] [st][patch] Update st-scrollback-mouse for 0.9.2 --- config.def.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.def.h b/config.def.h -index e3b469b..c217315 100644 +index 8b25d40..d259675 100644 --- a/config.def.h +++ b/config.def.h @@ -176,6 +176,8 @@ static uint forcemousemod = ShiftMask; @@ -21,5 +21,5 @@ index e3b469b..c217315 100644 { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, -- -2.34.1 +2.44.2 diff --git a/gentoo_portage/patches/x11-terms/st/st-xresources-20200604-9ba7ecf.diff b/gentoo_portage/patches/x11-terms/st/st-xresources-20230320-45a15676.diff similarity index 85% rename from gentoo_portage/patches/x11-terms/st/st-xresources-20200604-9ba7ecf.diff rename to gentoo_portage/patches/x11-terms/st/st-xresources-20230320-45a15676.diff index 78ba00a..d01a91b 100644 --- a/gentoo_portage/patches/x11-terms/st/st-xresources-20200604-9ba7ecf.diff +++ b/gentoo_portage/patches/x11-terms/st/st-xresources-20230320-45a15676.diff @@ -1,7 +1,7 @@ -From 2752a599ee01305a435729bfacf43b1dde7cf0ef Mon Sep 17 00:00:00 2001 -From: Benji Encalada Mora -Date: Thu, 4 Jun 2020 00:41:10 -0500 -Subject: [PATCH] fix: replace xfps and actionfps variables +From 6315407196933ec86be2b3c74f89bee746353e32 Mon Sep 17 00:00:00 2001 +From: harishnkr +Date: Mon, 20 Mar 2023 14:27:07 +0530 +Subject: [PATCH] Fix xresources bgcolour fgcolour and cscolour definitions --- config.def.h | 36 ++++++++++++++++++++++++ @@ -9,10 +9,10 @@ Subject: [PATCH] fix: replace xfps and actionfps variables 2 files changed, 110 insertions(+), 4 deletions(-) diff --git a/config.def.h b/config.def.h -index 6f05dce..9b99782 100644 +index 91ab8ca..f11db58 100644 --- a/config.def.h +++ b/config.def.h -@@ -168,6 +168,42 @@ static unsigned int defaultattr = 11; +@@ -170,6 +170,43 @@ static unsigned int defaultattr = 11; */ static uint forcemousemod = ShiftMask; @@ -37,9 +37,9 @@ index 6f05dce..9b99782 100644 + { "color13", STRING, &colorname[13] }, + { "color14", STRING, &colorname[14] }, + { "color15", STRING, &colorname[15] }, -+ { "background", STRING, &colorname[256] }, -+ { "foreground", STRING, &colorname[257] }, -+ { "cursorColor", STRING, &colorname[258] }, ++ { "background", STRING, &colorname[259] }, ++ { "foreground", STRING, &colorname[258] }, ++ { "cursorColor", STRING, &colorname[256] }, + { "termname", STRING, &termname }, + { "shell", STRING, &shell }, + { "minlatency", INTEGER, &minlatency }, @@ -50,13 +50,14 @@ index 6f05dce..9b99782 100644 + { "borderpx", INTEGER, &borderpx }, + { "cwscale", FLOAT, &cwscale }, + { "chscale", FLOAT, &chscale }, ++ { "alpha", FLOAT, &alpha }, +}; + /* * Internal mouse shortcuts. * Beware that overloading Button1 will disable the selection. diff --git a/x.c b/x.c -index 210f184..76f167f 100644 +index aa09997..ab10269 100644 --- a/x.c +++ b/x.c @@ -14,6 +14,7 @@ @@ -87,7 +88,7 @@ index 210f184..76f167f 100644 /* X modifiers */ #define XK_ANY_MOD UINT_MAX #define XK_NO_MOD 0 -@@ -828,8 +842,8 @@ xclear(int x1, int y1, int x2, int y2) +@@ -859,8 +873,8 @@ xclear(int x1, int y1, int x2, int y2) void xhints(void) { @@ -98,7 +99,7 @@ index 210f184..76f167f 100644 XWMHints wm = {.flags = InputHint, .input = 1}; XSizeHints *sizeh; -@@ -1104,8 +1118,6 @@ xinit(int cols, int rows) +@@ -1135,8 +1149,6 @@ xinit(int cols, int rows) pid_t thispid = getpid(); XColor xmousefg, xmousebg; @@ -107,7 +108,7 @@ index 210f184..76f167f 100644 xw.scr = XDefaultScreen(xw.dpy); xw.vis = XDefaultVisual(xw.dpy, xw.scr); -@@ -1964,6 +1976,59 @@ run(void) +@@ -2014,6 +2026,59 @@ run(void) } } @@ -167,7 +168,7 @@ index 210f184..76f167f 100644 void usage(void) { -@@ -2037,6 +2102,11 @@ run: +@@ -2087,6 +2152,11 @@ run: setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); @@ -180,5 +181,5 @@ index 210f184..76f167f 100644 rows = MAX(rows, 1); tnew(cols, rows); -- -2.26.2 +2.39.2