commit 34e86162a4a04b1be54e24bc1da8bede3c90f317
parent 044f85d3e614de7c31e52d2fbd423ba38a06cd92
Author: singpolyma@singpolyma.net <unknown>
Date: Tue, 6 Nov 2012 14:25:16 -0500
Add configwordbreak patch
Diffstat:
2 files changed, 80 insertions(+), 0 deletions(-)
diff --git a/st.suckless.org/patches/configwordbreak.md b/st.suckless.org/patches/configwordbreak.md
@@ -0,0 +1,26 @@
+configwordbreak
+===============
+
+Description
+-----------
+
+This is a patch to allow configuring which characters are used as
+word boundaries for double click selection (instead of just ' ').
+
+Usage
+-----
+
+example config.h
+
+ #define WORD_BREAK " ()<>[]\""
+
+Download
+--------
+* [st-0.3-configwordbreak.diff][0]
+
+[0]: st-0.3-configwordbreak.diff
+
+Author
+------
+
+ * Stephen Paul Weber - singpolyma
diff --git a/st.suckless.org/patches/st-0.3-configwordbreak.diff b/st.suckless.org/patches/st-0.3-configwordbreak.diff
@@ -0,0 +1,54 @@
+--- a/config.def.h
++++ b/config.def.h
+@@ -13,7 +13,7 @@ static unsigned int tripleclicktimeout = 600;
+ static char termname[] = "st-256color";
+
+ static unsigned int tabspaces = 8;
+-
++#define WORD_BREAK " "
+
+ /* Terminal colors (16 first used in escape sequence) */
+ static const char *colorname[] = {
+--- a/st.c
++++ b/st.c
+@@ -277,6 +277,7 @@ typedef struct {
+ } DC;
+
+ static void die(const char *, ...);
++static bool is_word_break(char);
+ static void draw(void);
+ static void redraw(void);
+ static void drawregion(int, int, int, int);
+@@ -835,12 +836,12 @@ brelease(XEvent *e) {
+ /* double click to select word */
+ sel.bx = sel.ex;
+ while(sel.bx > 0 && term.line[sel.ey][sel.bx-1].state & GLYPH_SET &&
+- term.line[sel.ey][sel.bx-1].c[0] != ' ') {
++ !is_word_break(term.line[sel.ey][sel.bx-1].c[0])) {
+ sel.bx--;
+ }
+ sel.b.x = sel.bx;
+ while(sel.ex < term.col-1 && term.line[sel.ey][sel.ex+1].state & GLYPH_SET &&
+- term.line[sel.ey][sel.ex+1].c[0] != ' ') {
++ !is_word_break(term.line[sel.ey][sel.ex+1].c[0])) {
+ sel.ex++;
+ }
+ sel.e.x = sel.ex;
+@@ -888,6 +889,17 @@ die(const char *errstr, ...) {
+ exit(EXIT_FAILURE);
+ }
+
++bool
++is_word_break(char c) {
++ static char *word_break = WORD_BREAK;
++ char *s = word_break;
++ while(*s) {
++ if(*s == c) return true;
++ s++;
++ }
++ return false;
++}
++
+ void
+ execsh(void) {
+ char **args;