]> git.armaanb.net Git - st.git/commitdiff
Allow more complex delimiters for word selections.
authorChristoph Lohmann <20h@r-36.net>
Sat, 4 May 2013 17:04:20 +0000 (19:04 +0200)
committerChristoph Lohmann <20h@r-36.net>
Sat, 4 May 2013 17:04:20 +0000 (19:04 +0200)
Thanks Alexander Rezinsky <alexrez@gmail.com>!

config.def.h
st.c

index d9a056865aef6fe275ff0d896dda0fac5a9ac971..2d854a0be7a283e944eae399c9c060ef50244df7 100644 (file)
@@ -9,7 +9,14 @@ static char font[] = "Liberation Mono:pixelsize=12:antialias=false:autohint=fals
 static int borderpx = 2;
 static char shell[] = "/bin/sh";
 
-/* timeouts (in milliseconds) */
+/*
+ * word delimiter string
+ *
+ * More advanced example: " `'\"()[]{}"
+ */
+static char worddelimiters[] = " ";
+
+/* selection timeouts (in milliseconds) */
 static unsigned int doubleclicktimeout = 300;
 static unsigned int tripleclicktimeout = 600;
 
diff --git a/st.c b/st.c
index 0f47d6df704b882b3770a7c87a5093c3cbe19cbf..5251e70660909f70de4fbda7b501cf33cc14a9e3 100644 (file)
--- a/st.c
+++ b/st.c
@@ -707,8 +707,10 @@ selsnap(int mode, int *x, int *y, int direction) {
                                }
                        }
 
-                       if(term.line[*y][*x + direction].c[0] == ' ')
+                       if(strchr(worddelimiters,
+                                       term.line[*y][*x + direction].c[0])) {
                                break;
+                       }
 
                        *x += direction;
                }