[hackers] [st] Allow more complex delimiters for word selections. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Sat, 04 May 2013 19:07:02 +0200

commit 8e968739c3cfc4e9f7088a9ea360bc4f37e9ad9f
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Sat May 4 19:04:20 2013 +0200

    Allow more complex delimiters for word selections.
    
    Thanks Alexander Rezinsky <alexrez_AT_gmail.com>!

diff --git a/config.def.h b/config.def.h
index d9a0568..2d854a0 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -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 0f47d6d..5251e70 100644
--- a/st.c
+++ b/st.c
_AT_@ -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;
                 }
Received on Sat May 04 2013 - 19:07:02 CEST

This archive was generated by hypermail 2.3.0 : Sat May 04 2013 - 19:12:09 CEST