[dev] [st] [PATCH] Use worddelimiters for word selection over wrapped lines.

From: Colona <colona_AT_ycc.fr>
Date: Wed, 4 Jun 2014 10:29:35 +0200

If a word delimiter was at the very beginning or end of one of the
different lines composing a wrapped line, the delimiter was ignored for
word selection. This now checks for delimiters before moving on to the
next part of a wrapped line.
---
 st.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/st.c b/st.c
index e0c64e3..912a37e 100644
--- a/st.c
+++ b/st.c
_AT_@ -711,8 +711,9 @@ selsnap(int mode, int *x, int *y, int direction) {
 		 */
 		for(;;) {
 			if(direction < 0 && *x <= 0) {
-				if(*y > 0 && term.line[*y - 1][term.col-1].mode
-						& ATTR_WRAP) {
+				if(*y > 0 && term.line[*y-1][term.col-1].mode & ATTR_WRAP
+						&& !strchr(worddelimiters,
+							term.line[*y-1][term.col-1].c[0])) {
 					*y -= 1;
 					*x = term.col-1;
 				} else {
_AT_@ -720,8 +721,8 @@ selsnap(int mode, int *x, int *y, int direction) {
 				}
 			}
 			if(direction > 0 && *x >= term.col-1) {
-				if(*y < term.row-1 && term.line[*y][*x].mode
-						& ATTR_WRAP) {
+				if(*y < term.row-1 && term.line[*y][*x].mode & ATTR_WRAP
+						&& !strchr(worddelimiters, term.line[*y+1][0].c[0])) {
 					*y += 1;
 					*x = 0;
 				} else {
-- 
2.0.0
-- 
Ivan "Colona" Delalande
Received on Wed Jun 04 2014 - 10:29:35 CEST

This archive was generated by hypermail 2.3.0 : Wed Jun 04 2014 - 10:36:06 CEST