summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2020-11-01 02:34:44 -0500
committerMatt Hunter <m@lfurio.us>2026-02-06 00:32:05 -0500
commit5e12fb719c4bd0064f57bdd90a32b0d805e3094e (patch)
tree7ce6faf2910554ff8a64b0af55817ee794e4d42e
parent3728de46418d26edffc21ac017d52ab668175b0b (diff)
downloadst-5e12fb719c4bd0064f57bdd90a32b0d805e3094e.tar.gz
st-5e12fb719c4bd0064f57bdd90a32b0d805e3094e.zip
patch: selection-unfuckHEADmaster
This patch addresses two issues with selections in st. First, the SelectionClear signal from X is no longer ignored. So, if another selection is made in another window, st's selection will disappear. Second (and this one is more of a personal preference), new selections that begin after the end of a line are now considered to begin at the start of the following line. This makes selecting a group of lines easier for either copy/paste or readability in the terminal. Previously, the newline character from the preceeding line would be included in the clipboard and the dead-space at the end of that line would be highlighted.
-rw-r--r--st.c5
-rw-r--r--x.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/st.c b/st.c
index 3837188..40732fc 100644
--- a/st.c
+++ b/st.c
@@ -495,7 +495,10 @@ selnormalize(void)
return;
i = tlinelen(sel.nb.y);
if (i < sel.nb.x)
- sel.nb.x = i;
+ {
+ sel.nb.x = 0;
+ sel.nb.y++;
+ }
if (tlinelen(sel.ne.y) <= sel.ne.x)
sel.ne.x = term.col - 1;
}
diff --git a/x.c b/x.c
index b194eab..b758f69 100644
--- a/x.c
+++ b/x.c
@@ -213,7 +213,7 @@ static void (*handler[LASTEvent])(XEvent *) = {
* Uncomment if you want the selection to disappear when you select something
* different in another window.
*/
-/* [SelectionClear] = selclear_, */
+ [SelectionClear] = selclear_,
[SelectionNotify] = selnotify,
/*
* PropertyNotify is only turned on when there is some INCR transfer happening