summaryrefslogtreecommitdiff
path: root/patches/bill_pursell_fFtT_402.patch
blob: e655643d65973f3ee614db5ce40692f33bcfba66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
From screen-users-bounces+jw=cs.fau.de@gnu.org  Fri Dec 16 22:23:46 2005
Received: from faui45.informatik.uni-erlangen.de (IDENT:root@fauern.informatik.uni-erlangen.de [131.188.34.45])
	by faui40.informatik.uni-erlangen.de (8.9.3p3/8.1.49-FAU) with ESMTP id WAA08712
	for <jnweiger@i4.informatik.uni-erlangen.de>; Fri, 16 Dec 2005 22:23:46 +0100 (MET)
Received: from lists.gnu.org (lists.gnu.org [199.232.76.165])
	by faui45.informatik.uni-erlangen.de (8.9.3p3/8.1.49-FAU) with ESMTP id WAA28416
	for <jw@cs.fau.de>; Fri, 16 Dec 2005 22:23:45 +0100 (MET)
Received: from localhost ([127.0.0.1] helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1EnN2o-0003P6-7M
	for jw@cs.fau.de; Fri, 16 Dec 2005 16:23:14 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1EnKWZ-000807-RE
	for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:48 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1EnKWY-0007yj-AQ
	for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:47 -0500
Received: from [199.232.76.173] (helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1EnKWX-0007y7-LZ
	for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:45 -0500
Received: from [64.233.162.195] (helo=zproxy.gmail.com)
	by monty-python.gnu.org with esmtp (Exim 4.34) id 1EnKZ0-0005Ig-91
	for screen-users@gnu.org; Fri, 16 Dec 2005 13:44:18 -0500
Received: by zproxy.gmail.com with SMTP id i11so687899nzh
	for <screen-users@gnu.org>; Fri, 16 Dec 2005 10:41:00 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
	h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding;
	b=htOg5ElAxJoDWlgFSUJd85Bf6mf7Y8FPLZRoIWCdtrnesxVHg1ZMe5zNYUb1pVC9iK8cGKMIAFbgysTC3CeGK9JEJBEk6xNJCs7y5s2vSILQ9zV67ZkkikyK4ke+2rCHmj7xYDlLW+JsdqbbnVJilY7Xl/cxgcy9+MIfOdnucKw=
Received: by 10.65.197.20 with SMTP id z20mr1443729qbp;
	Fri, 16 Dec 2005 10:41:00 -0800 (PST)
Received: from ?192.168.1.151? ( [82.24.24.234])
	by mx.gmail.com with ESMTP id q14sm641312qbq.2005.12.16.10.40.58;
	Fri, 16 Dec 2005 10:40:59 -0800 (PST)
Message-ID: <43A30A56.1030000@gmail.com>
Date: Fri, 16 Dec 2005 18:41:26 +0000
From: bill <bill.pursell@gmail.com>
User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Screen Users <screen-users@gnu.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Subject: fFtT patch
X-BeenThere: screen-users@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: General GNU Screen discussion <screen-users.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/screen-users>,
	<mailto:screen-users-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/screen-users>
List-Post: <mailto:screen-users@gnu.org>
List-Help: <mailto:screen-users-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/screen-users>,
	<mailto:screen-users-request@gnu.org?subject=subscribe>
Sender: screen-users-bounces+jw=cs.fau.de@gnu.org
Errors-To: screen-users-bounces+jw=cs.fau.de@gnu.org
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on 
	faui40.informatik.uni-erlangen.de
X-Spam-Level: 
X-Spam-Status: No, hits=-4.8 required=5.0 tests=BAYES_00,RCVD_IN_SORBS 
	autolearn=no version=2.63
Status: RO
Content-Length: 4721
Lines: 145

Here's the patch which implements the fFtT;, cursor movements.  I'm not
even remotely confident of this: I cut and pasted from a terminal
into thunderbird.

[reformatted by jw, 2005-12-19]

--- ./mark.c.orig	2005-12-16 19:48:09.000000000 +0100
+++ ./mark.c	2005-12-19 12:00:42.795719267 +0100
@@ -149,6 +149,55 @@
 #define NW_MUSTMOVE	(1<<2)
 #define NW_BIG		(1<<3)
 
+static int
+nextchar(int *xp, int *yp, int direction, char target, int num)
+{   /* Set *xp to the num-th occurrence of the target in the line. */
+
+    /* Return EXIT_FAILURE if the target doesn't appear num times.
+    Caller could use that to emit a warning. */
+
+    int    width;           /* width of the current window. */
+    int    x;               /* x coordinate of the current cursor position. */
+    int    step;            /* amount to increment x (+1 or -1) */
+    int    adjust;          /* Final adjustment of cursor position. */
+    char  *displayed_line;  /* Line in which search takes place. */
+
+    debug("nextchar\n");
+
+    x              = *xp;
+    adjust         = 0;
+    width          = fore->w_width;
+    displayed_line = WIN(*yp) -> image;
+
+    switch(direction) {
+    case 't': adjust = -1; /* fall through */
+    case 'f': step = 1;    /* fall through */
+        break;
+    case 'T': adjust = 1;  /* fall through */
+    case 'F': step = -1;   /* fall through */
+        break;
+    default:
+        ASSERT(0);
+    }
+
+    x += step;
+
+    debug1("ml->image = %s\n", displayed_line);
+    debug2("num = %d, width = %d\n",num, width);
+    debug2("x = %d targe = %c\n", x, target );
+
+    for ( ;x>=0 && x <= width; x += step) {
+        if (displayed_line[x] == target) {
+            if (--num == 0) {
+                *xp = x + adjust;
+                return EXIT_SUCCESS;
+            }
+        }
+    }
+    return EXIT_FAILURE;
+}
+
+
 static void
 nextword(xp, yp, flags, num)
 int *xp, *yp, flags, num;
@@ -534,8 +583,55 @@
 	}
       cx = markdata->cx;
       cy = markdata->cy;
+
+      if (markdata -> char_search[0]) {
+        debug2("searching for %c:%d\n",od,rep_cnt);
+        markdata->char_search[0] = 0;  /* Clear the flag. */
+        markdata->rep_cnt = 0;
+
+        if (isgraph (od)) {
+          markdata->char_search[1] = od;
+          rep_cnt = (rep_cnt) ? rep_cnt : 1;
+          nextchar(&cx, &cy, markdata->char_search[2], od, rep_cnt );
+          revto(cx, cy);
+          continue;
+        }
+      }
+
       switch (od)
 	{
+        case 'f': /* fall through */
+        case 'F': /* fall through */
+        case 't': /* fall through */
+        case 'T': /* fall through */
+            markdata -> char_search[0] = markdata->char_search[2] = od;
+            debug("entering char search\n");
+            continue;
+            /* If we break, rep_cnt will be reset, so we
+            continue instead.  It might be cleaner to
+            store the rep_count in char_search and
+            break here so later followon code will be
+            hit. */
+        case ';':
+                if (!rep_cnt) rep_cnt = 1;
+                nextchar(&cx, &cy, markdata->char_search[2], markdata->char_search[1], rep_cnt );
+                revto(cx, cy);
+                break;
+        case ',': {
+                int search_dir;
+                if (!rep_cnt) rep_cnt = 1;
+                switch (markdata->char_search[2]) {
+                case 't': search_dir = 'T'; break;
+                case 'T': search_dir = 't'; break;
+                case 'f': search_dir = 'F'; break;
+                case 'F': search_dir = 'f'; break;
+                }
+                nextchar(&cx, &cy, search_dir, markdata->char_search[1], rep_cnt );
+
+                revto(cx, cy);
+                break;
+            }
+
 	case 'o':
 	case 'x':
 	  if (!markdata->second)
--- ./mark.h.orig	2005-12-16 19:51:07.000000000 +0100
+++ ./mark.h	2005-12-19 12:03:10.405928022 +0100
@@ -41,6 +41,7 @@
   int	isdir;		/* current search direction */
   int	isstartpos;	/* position where isearch was started */
   int	isstartdir;	/* direction when isearch was started */
+  int   char_search[3];	
 };
 
 


_______________________________________________
screen-users mailing list
screen-users@gnu.org
http://lists.gnu.org/mailman/listinfo/screen-users