Don't forget the startup command.
[screen-lua.git] / patches / bill_pursell_fFtT_402.patch
blobe655643d65973f3ee614db5ce40692f33bcfba66
1 From screen-users-bounces+jw=cs.fau.de@gnu.org Fri Dec 16 22:23:46 2005
2 Received: from faui45.informatik.uni-erlangen.de (IDENT:root@fauern.informatik.uni-erlangen.de [131.188.34.45])
3 by faui40.informatik.uni-erlangen.de (8.9.3p3/8.1.49-FAU) with ESMTP id WAA08712
4 for <jnweiger@i4.informatik.uni-erlangen.de>; Fri, 16 Dec 2005 22:23:46 +0100 (MET)
5 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165])
6 by faui45.informatik.uni-erlangen.de (8.9.3p3/8.1.49-FAU) with ESMTP id WAA28416
7 for <jw@cs.fau.de>; Fri, 16 Dec 2005 22:23:45 +0100 (MET)
8 Received: from localhost ([127.0.0.1] helo=lists.gnu.org)
9 by lists.gnu.org with esmtp (Exim 4.43)
10 id 1EnN2o-0003P6-7M
11 for jw@cs.fau.de; Fri, 16 Dec 2005 16:23:14 -0500
12 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
13 id 1EnKWZ-000807-RE
14 for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:48 -0500
15 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
16 id 1EnKWY-0007yj-AQ
17 for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:47 -0500
18 Received: from [199.232.76.173] (helo=monty-python.gnu.org)
19 by lists.gnu.org with esmtp (Exim 4.43) id 1EnKWX-0007y7-LZ
20 for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:45 -0500
21 Received: from [64.233.162.195] (helo=zproxy.gmail.com)
22 by monty-python.gnu.org with esmtp (Exim 4.34) id 1EnKZ0-0005Ig-91
23 for screen-users@gnu.org; Fri, 16 Dec 2005 13:44:18 -0500
24 Received: by zproxy.gmail.com with SMTP id i11so687899nzh
25 for <screen-users@gnu.org>; Fri, 16 Dec 2005 10:41:00 -0800 (PST)
26 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
27 h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding;
28 b=htOg5ElAxJoDWlgFSUJd85Bf6mf7Y8FPLZRoIWCdtrnesxVHg1ZMe5zNYUb1pVC9iK8cGKMIAFbgysTC3CeGK9JEJBEk6xNJCs7y5s2vSILQ9zV67ZkkikyK4ke+2rCHmj7xYDlLW+JsdqbbnVJilY7Xl/cxgcy9+MIfOdnucKw=
29 Received: by 10.65.197.20 with SMTP id z20mr1443729qbp;
30 Fri, 16 Dec 2005 10:41:00 -0800 (PST)
31 Received: from ?192.168.1.151? ( [82.24.24.234])
32 by mx.gmail.com with ESMTP id q14sm641312qbq.2005.12.16.10.40.58;
33 Fri, 16 Dec 2005 10:40:59 -0800 (PST)
34 Message-ID: <43A30A56.1030000@gmail.com>
35 Date: Fri, 16 Dec 2005 18:41:26 +0000
36 From: bill <bill.pursell@gmail.com>
37 User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929)
38 X-Accept-Language: en-us, en
39 MIME-Version: 1.0
40 To: Screen Users <screen-users@gnu.org>
41 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
42 Content-Transfer-Encoding: 7bit
43 Subject: fFtT patch
44 X-BeenThere: screen-users@gnu.org
45 X-Mailman-Version: 2.1.5
46 Precedence: list
47 List-Id: General GNU Screen discussion <screen-users.gnu.org>
48 List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/screen-users>,
49 <mailto:screen-users-request@gnu.org?subject=unsubscribe>
50 List-Archive: <http://lists.gnu.org/pipermail/screen-users>
51 List-Post: <mailto:screen-users@gnu.org>
52 List-Help: <mailto:screen-users-request@gnu.org?subject=help>
53 List-Subscribe: <http://lists.gnu.org/mailman/listinfo/screen-users>,
54 <mailto:screen-users-request@gnu.org?subject=subscribe>
55 Sender: screen-users-bounces+jw=cs.fau.de@gnu.org
56 Errors-To: screen-users-bounces+jw=cs.fau.de@gnu.org
57 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on
58 faui40.informatik.uni-erlangen.de
59 X-Spam-Level:
60 X-Spam-Status: No, hits=-4.8 required=5.0 tests=BAYES_00,RCVD_IN_SORBS
61 autolearn=no version=2.63
62 Status: RO
63 Content-Length: 4721
64 Lines: 145
66 Here's the patch which implements the fFtT;, cursor movements. I'm not
67 even remotely confident of this: I cut and pasted from a terminal
68 into thunderbird.
70 [reformatted by jw, 2005-12-19]
72 --- ./mark.c.orig 2005-12-16 19:48:09.000000000 +0100
73 +++ ./mark.c 2005-12-19 12:00:42.795719267 +0100
74 @@ -149,6 +149,55 @@
75 #define NW_MUSTMOVE (1<<2)
76 #define NW_BIG (1<<3)
78 +static int
79 +nextchar(int *xp, int *yp, int direction, char target, int num)
80 +{ /* Set *xp to the num-th occurrence of the target in the line. */
82 + /* Return EXIT_FAILURE if the target doesn't appear num times.
83 + Caller could use that to emit a warning. */
85 + int width; /* width of the current window. */
86 + int x; /* x coordinate of the current cursor position. */
87 + int step; /* amount to increment x (+1 or -1) */
88 + int adjust; /* Final adjustment of cursor position. */
89 + char *displayed_line; /* Line in which search takes place. */
91 + debug("nextchar\n");
93 + x = *xp;
94 + adjust = 0;
95 + width = fore->w_width;
96 + displayed_line = WIN(*yp) -> image;
98 + switch(direction) {
99 + case 't': adjust = -1; /* fall through */
100 + case 'f': step = 1; /* fall through */
101 + break;
102 + case 'T': adjust = 1; /* fall through */
103 + case 'F': step = -1; /* fall through */
104 + break;
105 + default:
106 + ASSERT(0);
109 + x += step;
111 + debug1("ml->image = %s\n", displayed_line);
112 + debug2("num = %d, width = %d\n",num, width);
113 + debug2("x = %d targe = %c\n", x, target );
115 + for ( ;x>=0 && x <= width; x += step) {
116 + if (displayed_line[x] == target) {
117 + if (--num == 0) {
118 + *xp = x + adjust;
119 + return EXIT_SUCCESS;
123 + return EXIT_FAILURE;
127 static void
128 nextword(xp, yp, flags, num)
129 int *xp, *yp, flags, num;
130 @@ -534,8 +583,55 @@
132 cx = markdata->cx;
133 cy = markdata->cy;
135 + if (markdata -> char_search[0]) {
136 + debug2("searching for %c:%d\n",od,rep_cnt);
137 + markdata->char_search[0] = 0; /* Clear the flag. */
138 + markdata->rep_cnt = 0;
140 + if (isgraph (od)) {
141 + markdata->char_search[1] = od;
142 + rep_cnt = (rep_cnt) ? rep_cnt : 1;
143 + nextchar(&cx, &cy, markdata->char_search[2], od, rep_cnt );
144 + revto(cx, cy);
145 + continue;
149 switch (od)
151 + case 'f': /* fall through */
152 + case 'F': /* fall through */
153 + case 't': /* fall through */
154 + case 'T': /* fall through */
155 + markdata -> char_search[0] = markdata->char_search[2] = od;
156 + debug("entering char search\n");
157 + continue;
158 + /* If we break, rep_cnt will be reset, so we
159 + continue instead. It might be cleaner to
160 + store the rep_count in char_search and
161 + break here so later followon code will be
162 + hit. */
163 + case ';':
164 + if (!rep_cnt) rep_cnt = 1;
165 + nextchar(&cx, &cy, markdata->char_search[2], markdata->char_search[1], rep_cnt );
166 + revto(cx, cy);
167 + break;
168 + case ',': {
169 + int search_dir;
170 + if (!rep_cnt) rep_cnt = 1;
171 + switch (markdata->char_search[2]) {
172 + case 't': search_dir = 'T'; break;
173 + case 'T': search_dir = 't'; break;
174 + case 'f': search_dir = 'F'; break;
175 + case 'F': search_dir = 'f'; break;
177 + nextchar(&cx, &cy, search_dir, markdata->char_search[1], rep_cnt );
179 + revto(cx, cy);
180 + break;
183 case 'o':
184 case 'x':
185 if (!markdata->second)
186 --- ./mark.h.orig 2005-12-16 19:51:07.000000000 +0100
187 +++ ./mark.h 2005-12-19 12:03:10.405928022 +0100
188 @@ -41,6 +41,7 @@
189 int isdir; /* current search direction */
190 int isstartpos; /* position where isearch was started */
191 int isstartdir; /* direction when isearch was started */
192 + int char_search[3];
198 _______________________________________________
199 screen-users mailing list
200 screen-users@gnu.org
201 http://lists.gnu.org/mailman/listinfo/screen-users