-- -+#define WORD_BREAK " " - - /* Terminal colors (16 first used in escape sequence) */ - static const char *colorname[] = { -diff --git a/st.c b/st.c -index 8e0df08..2998468 100644 ---- a/st.c -+++ b/st.c -_AT_@ -279,6 +279,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); -_AT_@ -813,12 +814,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; -_AT_@ -866,6 +867,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; diff --git a/st.suckless.org/patches/st-0.3-wordbreak.diff b/st.suckless.org/patches/st-0.3-wordbreak.diff new file mode 100644 index 0000000..d8193e3 --- /dev/null +++ b/st.suckless.org/patches/st-0.3-wordbreak.diff _AT_@ -0,0 +1,58 @@ +diff --git a/config.def.h b/config.def.h +index 1ba6d8e..3ddbe10 100644 +--- a/config.def.h ++++ b/config.def.h +_AT_@ -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[] = { +diff --git a/st.c b/st.c +index 8e0df08..2998468 100644 +--- a/st.c ++++ b/st.c +_AT_@ -279,6 +279,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); +_AT_@ -813,12 +814,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; +_AT_@ -866,6 +867,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; diff --git a/st.suckless.org/patches/st-0.4-configwordbreak.diff b/st.suckless.org/patches/st-0.4-configwordbreak.diff deleted file mode 100644 index 578b325..0000000 --- a/st.suckless.org/patches/st-0.4-configwordbreak.diff +++ /dev/null _AT_@ -1,58 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 693bdbd..cba3754 100644 ---- a/config.def.h -+++ b/config.def.h -_AT_@ -21,7 +21,7 @@ static unsigned int actionfps = 30; - 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[] = { -diff --git a/st.c b/st.c -index 8b1fc56..8ed395c 100644 ---- a/st.c -+++ b/st.c -_AT_@ -294,6 +294,7 @@ typedef struct { - } DC; - - static void die(const char *, ...); -+static bool is_word_break(char); - static void draw(void); - static void redraw(int); - static void drawregion(int, int, int, int); -_AT_@ -920,12 +921,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; -_AT_@ -974,6 +975,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; diff --git a/st.suckless.org/patches/st-0.4-wordbreak.diff b/st.suckless.org/patches/st-0.4-wordbreak.diff new file mode 100644 index 0000000..578b325 --- /dev/null +++ b/st.suckless.org/patches/st-0.4-wordbreak.diff _AT_@ -0,0 +1,58 @@ +diff --git a/config.def.h b/config.def.h +index 693bdbd..cba3754 100644 +--- a/config.def.h ++++ b/config.def.h +_AT_@ -21,7 +21,7 @@ static unsigned int actionfps = 30; + 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[] = { +diff --git a/st.c b/st.c +index 8b1fc56..8ed395c 100644 +--- a/st.c ++++ b/st.c +_AT_@ -294,6 +294,7 @@ typedef struct { + } DC; + + static void die(const char *, ...); ++static bool is_word_break(char); + static void draw(void); + static void redraw(int); + static void drawregion(int, int, int, int); +_AT_@ -920,12 +921,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; +_AT_@ -974,6 +975,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; diff --git a/st.suckless.org/patches/st-0.4.1-configwordbreak.diff b/st.suckless.org/patches/st-0.4.1-configwordbreak.diff deleted file mode 100644 index 6ee66eb..0000000 --- a/st.suckless.org/patches/st-0.4.1-configwordbreak.diff +++ /dev/null _AT_@ -1,57 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index d1c20bd..d8db06d 100644 ---- a/config.def.h -+++ b/config.def.h -_AT_@ -24,7 +24,7 @@ static unsigned int actionfps = 30; - 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[] = { -diff --git a/st.c b/st.c -index 686ed5d..4f5bb05 100644 ---- a/st.c -+++ b/st.c -_AT_@ -288,6 +288,7 @@ typedef struct { - } DC; - - static void die(const char *, ...); -+static bool is_word_break(char); - static void draw(void); - static void redraw(int); - static void drawregion(int, int, int, int); -_AT_@ -933,11 +934,11 @@ brelease(XEvent *e) { - } else if(TIMEDIFF(now, sel.tclick1) <= doubleclicktimeout) { - /* double click to select word */ - sel.bx = sel.ex; -- while(sel.bx > 0 && term.line[sel.ey][sel.bx-1].c[0] != ' ') { -+ while(sel.bx > 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].c[0] != ' ') { -+ while(sel.ex < term.col-1 && !is_word_break(term.line[sel.ey][sel.ex+1].c[0])) { - sel.ex++; - } - sel.e.x = sel.ex; -_AT_@ -986,6 +987,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; diff --git a/st.suckless.org/patches/st-0.4.1-wordbreak.diff b/st.suckless.org/patches/st-0.4.1-wordbreak.diff new file mode 100644 index 0000000..6ee66eb --- /dev/null +++ b/st.suckless.org/patches/st-0.4.1-wordbreak.diff _AT_@ -0,0 +1,57 @@ +diff --git a/config.def.h b/config.def.h +index d1c20bd..d8db06d 100644 +--- a/config.def.h ++++ b/config.def.h +_AT_@ -24,7 +24,7 @@ static unsigned int actionfps = 30; + 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[] = { +diff --git a/st.c b/st.c +index 686ed5d..4f5bb05 100644 +--- a/st.c ++++ b/st.c +_AT_@ -288,6 +288,7 @@ typedef struct { + } DC; + + static void die(const char *, ...); ++static bool is_word_break(char); + static void draw(void); + static void redraw(int); + static void drawregion(int, int, int, int); +_AT_@ -933,11 +934,11 @@ brelease(XEvent *e) { + } else if(TIMEDIFF(now, sel.tclick1) <= doubleclicktimeout) { + /* double click to select word */ + sel.bx = sel.ex; +- while(sel.bx > 0 && term.line[sel.ey][sel.bx-1].c[0] != ' ') { ++ while(sel.bx > 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].c[0] != ' ') { ++ while(sel.ex < term.col-1 && !is_word_break(term.line[sel.ey][sel.ex+1].c[0])) { + sel.ex++; + } + sel.e.x = sel.ex; +_AT_@ -986,6 +987,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; diff --git a/st.suckless.org/patches/st-0.5-configwordbreak.diff b/st.suckless.org/patches/st-0.5-configwordbreak.diff deleted file mode 100644 index f30155e..0000000 --- a/st.suckless.org/patches/st-0.5-configwordbreak.diff +++ /dev/null _AT_@ -1,52 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 58b470e..8a8d968 100644 ---- a/config.def.h -+++ b/config.def.h -_AT_@ -47,7 +47,7 @@ static int bellvolume = 0; - 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[] = { -diff --git a/st.c b/st.c -index 392f12d..6a32d03 100644 ---- a/st.c -+++ b/st.c -_AT_@ -343,6 +343,7 @@ typedef struct { - } DC; - - static void die(const char *, ...); -+static bool is_word_break(char); - static void draw(void); - static void redraw(int); - static void drawregion(int, int, int, int); -_AT_@ -751,7 +752,7 @@ selsnap(int mode, int *x, int *y, int direction) { - */ - if(direction > 0) { - i = term.col; -- while(--i > 0 && term.line[*y][i].c[0] == ' ') -+ while(--i > 0 && is_word_break(term.line[*y][i].c[0])) - /* nothing */; - if(i > 0 && i < *x) - *x = term.col - 1; -_AT_@ -1141,6 +1142,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; diff --git a/st.suckless.org/patches/st-0.5-wordbreak.diff b/st.suckless.org/patches/st-0.5-wordbreak.diff new file mode 100644 index 0000000..f30155e --- /dev/null +++ b/st.suckless.org/patches/st-0.5-wordbreak.diff _AT_@ -0,0 +1,52 @@ +diff --git a/config.def.h b/config.def.h +index 58b470e..8a8d968 100644 +--- a/config.def.h ++++ b/config.def.h +_AT_@ -47,7 +47,7 @@ static int bellvolume = 0; + 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[] = { +diff --git a/st.c b/st.c +index 392f12d..6a32d03 100644 +--- a/st.c ++++ b/st.c +_AT_@ -343,6 +343,7 @@ typedef struct { + } DC; + + static void die(const char *, ...); ++static bool is_word_break(char); + static void draw(void); + static void redraw(int); + static void drawregion(int, int, int, int); +_AT_@ -751,7 +752,7 @@ selsnap(int mode, int *x, int *y, int direction) { + */ + if(direction > 0) { + i = term.col; +- while(--i > 0 && term.line[*y][i].c[0] == ' ') ++ while(--i > 0 && is_word_break(term.line[*y][i].c[0])) + /* nothing */; + if(i > 0 && i < *x) + *x = term.col - 1; +_AT_@ -1141,6 +1142,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; diff --git a/st.suckless.org/patches/wordbreak.md b/st.suckless.org/patches/wordbreak.md new file mode 100644 index 0000000..beeee22 --- /dev/null +++ b/st.suckless.org/patches/wordbreak.md _AT_@ -0,0 +1,29 @@ +wordbreak +========= + +Description +----------- + +This patch allows you to configure which characters are used as +word boundaries for double click selections (instead of just ' '). +This feature is already implemented in all versions later than 0.5. + +Usage +----- + +config.h example: + + #define WORD_BREAK " ()<>[]\"" + +Download +-------- +* [st-0.3-wordbreak.diff](st-0.3-wordbreak.diff) +* [st-0.4-wordbreak.diff](st-0.4-wordbreak.diff) +* [st-0.4.1-wordbreak.diff](st-0.4.1-wordbreak.diff) +* [st-0.5-wordbreak.diff](st-0.5-wordbreak.diff) + +Authors +------- + + * Stephen Paul Weber - singpolyma_AT_singpolyma.net + * Laslo Hunhold - dev_AT_frign.de (st-0.4, st-0.4.1, st-0.5 ports)Received on Thu Sep 17 2015 - 15:02:56 CEST
This archive was generated by hypermail 2.3.0 : Thu Sep 17 2015 - 15:12:11 CEST