source: trunk/src/netlabs/macros/locate.e@ 2756

Last change on this file since 2756 was 2756, checked in by Andreas Schnellbacher, 8 years ago
  • Added comments about how to work around EPM locate bugs.
  • Cosmetic changes.
  • Property svn:keywords set to Date Revision Author HeadURL Id
File size: 48.0 KB
Line 
1/****************************** Module Header *******************************
2*
3* Module Name: locate.e
4*
5* Copyright (c) Netlabs EPM Distribution Project 2002
6*
7* $Id: locate.e 2756 2017-09-30 19:45:58Z aschn $
8*
9* ===========================================================================
10*
11* This file is part of the Netlabs EPM Distribution package and is free
12* software. You can redistribute it and/or modify it under the terms of the
13* GNU General Public License as published by the Free Software
14* Foundation, in version 2 as it comes in the "COPYING" file of the
15* Netlabs EPM Distribution. This library is distributed in the hope that it
16* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18* General Public License for more details.
19*
20****************************************************************************/
21
22; Undocumented:
23; display -8 ==> messages go only to the msg line, not to the msg box.
24; display 8 ==> reenables messages from a previous display -8
25; The rest is documented in epmtech.inf.
26
27; 'xcom l', 'xcom c' and repeatfind:
28; o 'xcom l <delim><search_string><delim><search_options>' or
29; 'xcom c <delim><search_string><delim><change_string><delim><search_options>'
30; can be specified without <delim><search_options>. Then the internal
31; default options are used: +FAE.
32; o Doubled or exclusive options may be specified. The last option wins.
33; o 'xcom l' and 'xcom c' store their command line in the same internal var.
34; It can be queried with getsearch and be set with setsearch. That var is
35; empty on EPM's start.
36; o repeatfind uses the previous search line of 'xcom l' or 'xcom c', but
37; always executes 'xcom l'. It can't be used for repeated change.
38; o Bugs of 'xcom l', 'xcom c' and repeatfind:
39; - 'xcom l' and 'xcom c' don't move the cursor, repeatfind does.
40; - With option R (reversed search), it also finds the search string at
41; the cursor.
42; o Bugs of the original 'Locate' = 'l' and 'Change' = 'c' commands:
43; - The bugs of 'xcom l', 'xcom c' and repeatfind, except that the
44; cursor is moved after 'l' or 'c'.
45; - The cursor position after a 'c' was wrong: It was moved by the length
46; of the search string, not of the replace string.
47; o The above bugs are fixed/workarounded by the current 'Locate' = 'l'
48; and 'Change' = 'c' commands.
49; o Without pre- and postprocessing, 'xcom l', 'xcom c' and repeatfind
50; should only be used for forward find (locate) searches and not for
51; replace (change).
52
53; ---------------------------------------------------------------------------
54
55compile if not defined(SMALL) -- If SMALL not defined, then being separately compiled
56define INCLUDING_FILE = 'LOCATE.E'
57
58const
59compile if not defined(LOCATE_CIRCLE_STYLE)
60 --LOCATE_CIRCLE_STYLE = 1 -- changed by aschn
61 LOCATE_CIRCLE_STYLE = 5 -- (1) filled oval
62compile endif
63compile if not defined(LOCATE_CIRCLE_COLOR1)
64 --LOCATE_CIRCLE_COLOR1 = 16777220 -- changed by aschn
65 LOCATE_CIRCLE_COLOR1 = 16777231 -- (16777220) complementary
66compile endif
67compile if not defined(LOCATE_CIRCLE_COLOR2)
68 -- for styles 2 and 4 only
69 --LOCATE_CIRCLE_COLOR2 = 16777218 -- changed by aschn
70 LOCATE_CIRCLE_COLOR2 = 16777216 -- (16777218) complementary
71compile endif
72compile if not defined(HIGHLIGHT_COLOR)
73 HIGHLIGHT_COLOR = 14 -- This must be set to enable circle colors
74compile endif
75
76const
77 compile if not defined(NLS_LANGUAGE)
78 NLS_LANGUAGE = 'ENGLISH'
79 compile endif
80 include NLS_LANGUAGE'.e'
81 include 'stdconst.e'
82
83 EA_comment 'This defines macros for saerch operations.'
84compile endif
85
86; ---------------------------------------------------------------------------
87defmodify -- This stops the modification dialog for grep output "files" -- JBS
88 if leftstr( .filename, 17) = '.Output from grep' then
89 .modify = 0
90 .autosave = 0
91 endif
92
93; ---------------------------------------------------------------------------
94; Preprocessor 1 for Locate and Change. It
95; o makes the search options uppercase.
96; o removes the M option from the default search options when the current
97; file is not marked.
98; o removes T and B options from deafult search options when a search is
99; executed by the Search dialog. (The Top, Bottom and Cursor radio
100; buttons were not automatically set or unset subject to the T and B
101; default options. Instead of that, they keep their last selection the
102; user has made via the dialog, while after an EPM restart, they open
103; always with the Cursor button activated.)
104; o combines the default search options with the user search options.
105; o removes doubled and exclusive options. (For xcom l, the last option
106; wins.)
107; Returns: search_options
108defproc ProcessSearchOptions( user_options)
109 universal default_search_options
110
111 -- Set default_options to uppercase
112 default_options = upcase( default_search_options)
113
114 -- Switch to All if Mark is default and no text marked, but don't disable
115 -- 'M' from user_options to make it work as expected.
116 if not FileIsMarked() then
117 -- Remove 'M' from default_options
118 do forever
119 pv = verify( default_options, 'M', 'M') -- 2nd arg is charlist to find
120 if pv = 0 then
121 leave
122 endif
123 default_options = delstr( default_options, pv, 1)
124 enddo
125 endif
126
127 -- Workaround used when called by the search dialog:
128 -- Remove 'T' and 'B' from default_options, because searchdlg won't
129 -- set these checkboxes. Other options are recognized. This is useful
130 -- to avoid confusion, because searchdlg will call either defc locate
131 -- or defc change. These commands will add default_search_options,
132 -- even T or B, while the user would think, he hasn't selected them.
133 -- TODO: Better set 'Top' or 'Bottom' checkboxes when opening the
134 -- search dialog or when changing default options.
135 -- TODO: Automatically set the 'Marked area' checkbox
136 -- - (if mark is visible in the window or)
137 -- - if current file is marked.
138 -- Add an option for that as well.
139 if pos( 'D', upcase( user_options)) then -- if called from SearchDlg
140 do forever
141 pv = verify( upcase(default_options), 'TB', 'M')
142 if pv = 0 then
143 leave
144 endif
145 default_options = delstr( default_options, pv, 1)
146 enddo
147 endif
148
149 -- Remove 'T', 'B' and 'U' from default_options if the new option 'U' is
150 -- used. This new option can be added to tell the locate command to remove
151 -- 'T' and 'B'. E.g. the 'All' cmd doesn't work with B' or 'T'.
152 if pos( 'U', upcase(user_options)) then -- if 'U' is used
153 -- Remove 'U' from user_options
154 do forever
155 pv = verify( upcase(user_options), 'U', 'M')
156 if pv = 0 then
157 leave
158 endif
159 user_options = delstr( user_options, pv, 1)
160 enddo
161 -- Remove 'T' and 'B' from default_options
162 do forever
163 pv = verify( default_options, 'TB', 'M')
164 if pv = 0 then
165 leave
166 endif
167 default_options = delstr( default_options, pv, 1)
168 enddo
169 endif
170
171 -- Build search_options. The last option wins.
172 -- Insert default_search_options just before supplied options (if any)
173 -- so the supplied options will take precedence.
174 search_options = upcase(default_options''user_options)
175
176 -- Append 'N' to give a message how many changes, if 'Q' not specified
177 -- and if all should be changed.
178 if pos( '*', search_options) & -- if e.g. called from SearchDlg
179 not pos( 'Q', search_options) then
180 search_options = search_options'N'
181 endif
182
183 -- Remove multiple and excluding options and spaces (not required)
184 ExcludeList = '+- FR BT AM EC GXW' -- for every word in this list: every char excludes each other
185 -- Other options: '* K ^ N D'
186 rest = search_options
187 search_options = ''
188 do while rest <> ''
189 parse value rest with next 2 rest -- parse 1 char of rest
190 -- Remove all spaces
191 if next = ' ' then
192 iterate
193 elseif pos( next, rest) = 0 then -- if not found in rest
194 -- Find excluding options
195 ExcludeWrd = ''
196 do w = 1 to words(ExcludeList)
197 wrd = word( ExcludeList, w)
198 if pos( next, wrd) then
199 ExcludeWrd = wrd -- ExcludeWrd = word of ExcludeList where next belongs to
200 leave
201 endif
202 enddo
203 if not verify( rest, ExcludeWrd, 'M') then -- if rest doesn't contain chars of ExcludeWrd
204 search_options = search_options''next -- append next
205 endif
206 endif
207 enddo
208
209 return search_options
210
211; ---------------------------------------------------------------------------
212; Preprocessor 2 for Locate and Change. It
213; o determines if a find-next is executed (when search options, search
214; string and file id haven't changed).
215; o removes T and B options when a find-next is executed. (Also the Search
216; dialog doesn't switch automatcally from Top or Bottom to Cursor then.)
217; o corrects the cursor position before a search action, when required as a
218; workaround for 'xcom l' bugs to avoid finding false strings.
219; Returns: search_options
220; or -1 if a search can't be processed, due to the cursor position
221; and the search direction
222defproc ProsessSearchPos( search_options, PrevSearchOptions,
223 search_string, PrevSearchString,
224 fid, SearchMode)
225 universal lastsearchpos
226
227 parse value lastsearchpos with LastLine LastCol LastFid LastSearchLen LastSearchMode
228 fForeward = lastpos( 'F', search_options) > lastpos( 'R', search_options)
229 fDownward = lastpos( '+', search_options) > lastpos( '-', search_options)
230
231 -- Determine a FindNext if only the search direction was changed
232 fFindNext = 0
233 do i = 1 to 1
234 -- Remove FR+- from previous and next search options
235 PrevOpts = PrevSearchOptions
236 do forever
237 pv = verify( PrevOpts, 'FR+-', 'M')
238 if pv = 0 then
239 leave
240 endif
241 PrevOpts = delstr( PrevOpts, pv, 1)
242 enddo
243 NextOpts = search_options
244 do forever
245 pv = verify( NextOpts, 'FR+-', 'M')
246 if pv = 0 then
247 leave
248 endif
249 NextOpts = delstr( NextOpts, pv, 1)
250 enddo
251
252 if fid <> LastFid then
253 leave
254 endif
255 if LastLine LastCol <> .line .col then
256 leave
257 endif
258 if PrevSearchString <> search_string then
259 leave
260 endif
261 if PrevOpts <> NextOpts then
262 leave
263 endif
264
265 fFindNext = 1
266 enddo
267
268 fMoveCursor = 0
269
270 -- Handle FindNext specially
271 if fFindNext then
272
273 -- Remove 'T' and 'B' for the search execution (not from LastSearchArgs)
274 do forever
275 pv = verify( search_options, 'TB', 'M')
276 if pv = 0 then
277 leave
278 endif
279 search_options = delstr( search_options, pv, 1)
280 enddo
281
282 -- Move cursor to not find the just found string again
283 fMoveCursor = 1
284 endif
285
286 -- Bug in xcom l: reverse search finds also string right of cursor
287 if not fForeward then
288 fMoveCursor = 1
289 endif
290
291 -- Change should process the string at cursor. The cursor pos may result
292 -- from a previous locate.
293 -- If there is no string to change at the cursor, it processes the next
294 -- string. For that no cursor move is required.
295 if SearchMode = 'c' then
296 fMoveCursor = 0
297 endif
298
299 --dprintf( 'fMoveCursor = 'fMoveCursor', fFindNext = 'fFindNext)
300
301 fSearch = 1
302 -- Move cursor to not find the string at cursor (again)
303 if fMoveCursor then
304 if LastSearchLen = '' then
305 LastSearchLen = 0
306 endif
307 if fForeward then -- must be a FindNext
308 -- Foreward: move amount of LastSearchLen right
309 next = .col + LastSearchLen
310 if next > length( textline(.line)) + 1 then
311 if fDownward then
312 if .line < .last then
313 down
314 .col = 1
315 else
316 fSearch = 0 -- can't move down at the bottom
317 endif
318 else
319 if .line > 1 then
320 up
321 .col = 1
322 else
323 fSearch = 0 -- can't move up at the top
324 endif
325 endif
326 else
327 .col = next
328 endif
329 else
330 -- Backward: move 1 left
331 next = .col - 1
332 if next < 1 then
333 if fDownward then
334 if .line < .last then
335 down
336 .col = min( length( textline(.line)) + 1, MAXCOL)
337 else
338 fSearch = 0 -- can't move down at the bottom
339 endif
340 else
341 if .line > 1 then
342 up
343 .col = min( length( textline(.line)) + 1, MAXCOL)
344 else
345 fSearch = 0 -- can't move up at the top
346 endif
347 endif
348 else
349 .col = next
350 endif
351 endif
352 endif
353
354 if not fSearch then
355 return -1
356 else
357 return search_options
358 endif
359
360; ---------------------------------------------------------------------------
361; LastSearchArgs and LastChangeArgs are no longer universals. To make them
362; global across all EPM windows, they are saved in NEPMD.INI only.
363; ---------------------------------------------------------------------------
364defproc GetLastSearchArgs
365 KeyPathSearch = '\NEPMD\User\Search\LastSearchArgs'
366 LastSearchArgs = QueryConfigKey( KeyPathSearch)
367 return LastSearchArgs
368
369; ---------------------------------------------------------------------------
370defproc GetLastChangeArgs
371 KeyPathChange = '\NEPMD\User\Search\LastChangeArgs'
372 LastChangeArgs = QueryConfigKey( KeyPathChange)
373 return LastChangeArgs
374
375; ---------------------------------------------------------------------------
376defproc SetLastSearchArgs
377 KeyPathSearch = '\NEPMD\User\Search\LastSearchArgs'
378 LastSearchArgs = arg(1)
379 call WriteConfigKey( KeyPathSearch, LastSearchArgs)
380 return
381
382; ---------------------------------------------------------------------------
383defproc SetLastChangeArgs
384 KeyPathChange = '\NEPMD\User\Search\LastChangeArgs'
385 LastChangeArgs = arg(1)
386 call WriteConfigKey( KeyPathChange, LastChangeArgs)
387 return
388
389; ---------------------------------------------------------------------------
390; Syntax: locate !<search_string>[!<user_options>]
391; The first char will be taken as delimitter, in this case '!'.
392;
393; New: Without args, a FindNext will be executed.
394;
395; Added a new search option: 'U'. This will replace any occurance of
396; 'T' and 'B' in default_search_options for this locate command.
397;
398; Moved from STDCMDS.E
399; Note: this DEFC also gets executed by the slash ('/') command and by the
400; search dialog. The search dialog adds option 'D'.
401defc RepeatFind, L, Locate
402 universal default_search_options
403 universal lastsearchpos
404
405 sayerror 0 -- delete previous message from messageline
406 LastSearchArgs = GetLastSearchArgs()
407
408 args = strip( arg(1), 'L')
409 if args = '' then -- If no args, query args
410 args = LastSearchArgs
411 -- Process the parsing of args again to recognize a possible change of
412 -- default_search_options in the meantime.
413 endif
414
415 delim = substr( args, 1, 1) -- get 1st delimiter
416 parse value args with (delim)search_string(delim)user_options
417 user_options = strip( user_options, 'T', delim)
418
419 PrevSearchArgs = LastSearchArgs -- save old value to determine later
420 -- if it has to be rewritten to ini.
421 pdelim = substr( PrevSearchArgs, 1, 1) -- get 1st delimiter
422 parse value PrevSearchArgs with (pdelim)PrevSearchString(pdelim)PrevSearchOptions
423
424 -- The current SearchString is copmared with that of LastChangeArgs.
425 -- If another string was specified, then LastChangeArgs is reset to ''.
426 LastChangeArgs = GetLastChangeArgs()
427 cdelim = substr( LastChangeArgs, 1, 1) -- get 1st delimiter
428 parse value LastChangeArgs with (cdelim)cSearchString(cdelim)cReplaceString(cdelim)cSearchOptions
429
430 getfileid fid
431
432 -- Prepend default options and normalize search options
433 search_options = ProcessSearchOptions( user_options)
434
435 -- Build list of search args with options, last option wins.
436 -- Save the universal var here. Later ProsessSearchPos changes
437 -- search_options if required.
438 SearchArgs = delim''search_string''delim''search_options
439 --dprintf( '--- SearchArgs = 'SearchArgs', arg(1) = 'arg(1))
440 --dprintf( 'PrevSearchArgs = 'PrevSearchArgs)
441
442 parse value lastsearchpos with LastLine LastCol LastFid LastSearchLen LastSearchMode
443
444 -- Save last args
445 call SetLastSearchArgs( SearchArgs)
446 if search_string <> cSearchString | fid <> LastFid then
447 -- Reset LastChangeArgs if search has changed
448 --dprintf( 'Reset LastChangeArgs')
449 call SetLastChangeArgs( '')
450 endif
451
452 -- The rest is similar for both 'locate' and 'change'
453
454 -- Pos from before the search and maybe move
455 startline = .line
456 startcol = .col
457 call psave_pos( savedpos)
458 SearchMode = 'l'
459
460 --dprintf( 'Before ProsessSearchPos: search_options = 'search_options', PrevSearchOptions = 'PrevSearchOptions)
461 -- Maybe move cursor and remove T and B search options for a FindNext
462 search_options = ProsessSearchPos( search_options, PrevSearchOptions,
463 search_string, PrevSearchString,
464 fid, SearchMode)
465 --dprintf( 'After ProsessSearchPos: search_options = 'search_options', PrevSearchOptions = 'PrevSearchOptions)
466 fSearch = 1
467 if search_options = -1 then
468 -- Omit search at the top or at the bottom
469 fSearch = 0
470 else
471 -- search_options may be changed by ProsessSearchPos
472 SearchArgs = delim''search_string''delim''search_options
473 endif
474
475 if fSearch then
476 display -8 -- suppress writing to MsgBox
477 'xcom l 'SearchArgs
478 lrc = rc
479 display 8
480
481 -- Restore pos if not found (required?)
482 if lrc <> 0 then
483 -- Go to pos before the search, e.g. stop at previous found string
484 call prestore_pos( savedpos)
485 endif
486 endif
487
488 -- Give error message if search was omitted
489 if not fSearch then
490 lrc = -273 -- String not found
491 display -8 -- suppress writing to MsgBox
492 sayerror sayerrortext( lrc) -- The same as: 'SayError -273'
493 display 8
494 endif
495
496 -- Highlight it and maybe scroll to cursor pos
497 if lrc = 0 then
498 -- SearchLen will be queried by getpminfo( EPMINFO_LSLENGTH)
499 call highlight_match()
500 else
501 .line = .line -- maybe scroll to ensure that cursor is visible
502 endif
503
504 -- Save last searched pos, file and search mode
505 thissearchpos = .line .col fid length( search_string) 'l'
506 --dprintf( 'thissearchpos = 'thissearchpos', lastsearchpos = 'lastsearchpos)
507 lastsearchpos = thissearchpos
508
509 rc = lrc -- does hightlight_match change rc?
510
511; ---------------------------------------------------------------------------
512; Moved from STDCMDS.E
513defc RepeatChange, C, Change
514 universal default_search_options
515; universal search_len
516 universal lastsearchpos
517 universal stay -- if 1, then restore pos even after a successful change
518
519 sayerror 0 -- delete previous message from messageline
520 LastChangeArgs = GetLastChangeArgs()
521 LastSearchArgs = GetLastSearchArgs()
522 call NextCmdAltersText()
523
524 args = strip( arg(1), 'L')
525 if args = '' then -- If no args, query lastchangeargs
526 args = LastChangeArgs
527 -- Process the parsing of args again to recognize a possible change of
528 -- default_search_options in the meantime.
529 endif
530
531 delim = substr( args, 1, 1) -- get 1st delimiter
532 p2 = pos( delim, args, 2) -- check 2nd delimiter of 2 or 3
533 if not p2 then
534 sayerror NO_REP__MSG -- 'No replacement string specified' (Rather the missing delimiter is checked.)
535 return
536 endif
537 parse value args with (delim)search_string(delim)replace_string(delim)user_options
538 user_options = strip( user_options, 'T', delim)
539
540 PrevSearchArgs = LastSearchArgs -- if it has to be rewritten to ini.
541 pdelim = substr( PrevSearchArgs, 1, 1) -- get 1st delimiter
542 parse value PrevSearchArgs with (pdelim)PrevSearchString(pdelim)PrevSearchOptions
543
544 PrevChangeArgs = LastChangeArgs -- save old value to determine later
545 -- If PrevChangeArgs was reset by the last search ...
546 if PrevChangeArgs = '' then
547 -- ... get args from last search, not from last change
548 PrevChangeArgs = delim''PrevSearchString''delim''replace_string''delim''PrevSearchOptions
549 endif
550 pdelim = substr( PrevChangeArgs, 1, 1) -- get 1st delimiter
551 parse value PrevChangeArgs with (pdelim)PrevSearchString(pdelim)PrevReplaceString(pdelim)PrevSearchOptions
552
553 getfileid fid
554
555 -- Prepend default options and normalize search options
556 search_options = ProcessSearchOptions( user_options)
557
558 -- Build list of change args with options, last option wins.
559 -- Save the universal var here. Later ProsessSearchPos changes
560 -- search_options if required.
561 ChangeArgs = delim''search_string''delim''replace_string''delim''search_options
562 -- Set LastSearchArgs as well, to use first Ctrl+F and then Ctrl+C for to
563 -- operate on the same search_string. Even a ChangeNext should synchronize it.
564 SearchArgs = delim''search_string''delim''search_options
565 --dprintf( '--- ChangeArgs = 'ChangeArgs', arg(1) = 'arg(1))
566 --dprintf( '--- SearchArgs = 'SearchArgs', arg(1) = 'arg(1))
567 --dprintf( 'PrevChangeArgs = 'PrevChangeArgs', PrevSearchArgs = 'PrevSearchArgs)
568
569 -- Save last args
570 call SetLastChangeArgs( ChangeArgs)
571 call SetLastSearchArgs( SearchArgs)
572
573 -- Pos from before the search and maybe move
574 startline = .line
575 startcol = .col
576 call psave_pos( savedpos)
577 SearchMode = 'c'
578
579 --dprintf( 'Before ProsessSearchPos: search_options = 'search_options', PrevSearchOptions = 'PrevSearchOptions)
580 -- Remove T and B search options for a FindNext
581 search_options = ProsessSearchPos( search_options, PrevSearchOptions,
582 search_string, PrevSearchString,
583 fid, SearchMode)
584 --dprintf( 'After ProsessSearchPos: search_options = 'search_options', PrevSearchOptions = 'PrevSearchOptions)
585
586 fSearch = 1
587 if search_options = -1 then -- never true for 'change'
588 -- Omit search at the top or at the bottom
589 fSearch = 0
590 else
591 -- search_options may be changed by ProsessSearchPos
592 ChangeArgs = delim''search_string''delim''replace_string''delim''search_options
593 endif
594
595
596 if fSearch then
597 display -8
598 'xcom c 'ChangeArgs
599 lrc = rc
600 display 8
601
602 -- Restore pos if not found (required?)
603 if lrc <> 0 then
604 -- Go to pos before the search, e.g. stop at previous found string
605 call prestore_pos( savedpos)
606 endif
607 endif
608
609 -- Give error message if search was omitted
610 if not fSearch then -- fSearch is always 1 for 'change'
611 lrc = -273 -- String not found
612 display -8 -- suppress writing to MsgBox
613 sayerror sayerrortext( lrc) -- The same as: 'SayError -273'
614 display 8
615 endif
616
617 -- Highlight it and maybe scroll to cursor pos
618 if lrc = 0 then
619 --call highlight_match() -- gives wrong value
620 -- SearchLen can be queried for a Search action by getpminfo( EPMINFO_LSLENGTH).
621 -- But getpminfo( EPMINFO_LSLENGTH) gives the value for the search string,
622 -- not for the change string.
623 -- Therefore estimate its value here to submit it as arg to highlight_match().
624 -- This likely gives a wrong result for a grep search.
625 SearchLen = length( replace_string)
626 call highlight_match( .line .col SearchLen)
627
628 -- Restore pos after change command if stay = 1
629 if stay then
630 call prestore_pos( savedpos)
631 endif
632 else
633 .line = .line -- maybe scroll to ensure that cursor is visible
634 'HighlightCursor'
635 endif
636
637 -- Save last searched pos, file and search mode
638 thissearchpos = .line .col fid length( replace_string) 'c'
639 --dprintf( 'thissearchpos = 'thissearchpos', lastsearchpos = 'lastsearchpos)
640 lastsearchpos = thissearchpos
641
642; ---------------------------------------------------------------------------
643; Moved from STDPROCS.E
644; Highlight a "hit" after a Locate command or Repeat_find operation.
645; Never used its previous arg(1) = search_len in 6.03b.
646; New: optional arg(1) = <line> <col> <len>
647defproc highlight_match
648
649 if rc then -- if not found; rc was set from last 'c'|'l'|repeat_find
650 return
651 endif
652 savedrc = rc
653
654 -- Optionally try to scroll to a fixed position on screen.
655 -- This must come before drawing the circle.
656 'ScrollAfterLocate'
657
658 parse arg args
659 if args <> '' then
660 parse arg line col len
661 if col = '' then
662 -- This must be the previously used syntax: arg(1) = search_len
663 args = ''
664 endif
665 endif
666 if args = '' then
667 line = .line
668 col = GetPmInfo( EPMINFO_SEARCHPOS)
669 len = GetPmInfo( EPMINFO_LSLENGTH)
670 endif
671 if col = 0 then
672 col = .col
673 endif
674
675 -- Draw a circle around the found string
676 CircleIt LOCATE_CIRCLE_STYLE,
677 line,
678 col,
679 col + len - 1,
680 LOCATE_CIRCLE_COLOR1,
681 LOCATE_CIRCLE_COLOR2
682
683 rc = savedrc
684 return
685
686; ---------------------------------------------------------------------------
687; Callable with 'postme'. Required for GlobalFind.
688defc HighlightMatch
689 call highlight_match(arg(1))
690
691; ---------------------------------------------------------------------------
692defc CircleIt
693 parse arg line startcol endcol
694 CircleIt LOCATE_CIRCLE_STYLE, line, startcol, endcol,
695 LOCATE_CIRCLE_COLOR1, LOCATE_CIRCLE_COLOR2
696
697; ---------------------------------------------------------------------------
698; Try to scroll to a fixed position on screen.
699defc ScrollAfterLocate
700 KeyPath = '\NEPMD\User\CursorPos\ScrollAfterLocate'
701 IniValue = QueryConfigKey( KeyPath)
702 AmountOfLines = 0
703 if IsNum( IniValue) then
704 AmountOfLines = IniValue
705 endif
706 if AmountOfLines <> 0 then
707 oldline = .line
708 if AmountOfLines > 0 then
709 .cursory = Min( AmountOfLines, .windowheight) -- AmountOfLines from top
710 elseif AmountOfLines < 0 then
711 .cursory = Max( 1, .windowheight + AmountOfLines + 1) -- AmountOfLines from bottom
712 endif
713 .line = oldline
714 endif
715
716; ---------------------------------------------------------------------------
717; Moved from STDCTRL.E
718; Can also be called with C or F as arg to repeat last change or find.
719/*
720ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
721³ what's it called: searchdlg syntax: searchdlg [next] ³
722³ ³
723³ what does it do : ask EPM.EXE to pop up its internal search & replace dlg. ³
724³ This is done by posting a EPM_POPCHANGEDLG message to the³
725³ EPM Book window. ³
726³ if the [next] param = 'F' a find next will take place ³
727³ if the [next] param = 'C' a change next will take place ³
728³ ³
729³ (All EPM_EDIT_xxx messages are defined in the ETOOLKT ³
730³ PACKAGE available on PCTOOLS.) ³
731³ ³
732³ who and when : Jerry C. 2/27/89 ³
733ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
734*/
735defc SearchDlg
736 universal default_search_options
737
738 parse value upcase(arg(1)) with uparg .
739
740 if uparg = 'C' then
741 'RepeatChange'
742 elseif uparg = 'F' then
743 'RepeatFind'
744
745 else
746 -- The application will free the buffer allocated by this macro
747 call windowmessage( 0, getpminfo(APP_HANDLE),
748 5128, -- EPM_POPCHANGEDLG
749 0,
750 put_in_buffer(default_search_options))
751 endif
752
753; ---------------------------------------------------------------------------
754; Returns '+' or '-'.
755defproc GetSearchDirection
756 universal default_search_options
757 ret = '+'
758
759 args = GetLastSearchArgs()
760 s_delim = substr( args, 1, 1) -- get 1st delimiter
761 parse value args with (s_delim)s_search_string(s_delim)s_user_options
762 s_user_options = strip( s_user_options, 'T', s_delim)
763
764 -- Analyze only last search options, not last change options
765 Minuspos = lastpos( '-', default_search_options''s_user_options)
766 Pluspos = lastpos( '+', default_search_options''s_user_options)
767
768 if MinusPos > PlusPos then
769 ret = '-'
770 endif
771 return ret
772
773; ---------------------------------------------------------------------------
774; From EPMSMP\REVERSE.E
775; Search options for specifying the direction:
776; F start searching from the start of line
777; R start searching from the end of line
778; + start searching from the start of text
779; - start searching from the end of text
780; The relevant options are + and -, F or R is set automatically.
781;
782; Original by Larry Margolis:
783; Repeat the previous Locate, but in the reverse direction.
784; E.g., if you search for a string that you know exists, but
785; it's not found before the end of the file, press Ctrl+minus
786; to repeat the search for the same string looking from the
787; cursor position to the beginning of the file.
788; Changed:
789; Toggles the search direction (options +F or -R) without any
790; following locate action.
791; Doesn't produce an error msg anymore if oldsearch = empty.
792; This has no effect on the settings of the Search dialog.
793defc ToggleSearchDirection
794 universal default_search_options
795
796 args = GetLastSearchArgs()
797 s_delim = substr( args, 1, 1) -- get 1st delimiter
798 parse value args with (s_delim)s_search_string(s_delim)s_user_options
799 s_user_options = strip( s_user_options, 'T', s_delim)
800
801 -- Analyze only last search options, not last change options
802 Minuspos = lastpos( '-', default_search_options''s_user_options)
803 Pluspos = lastpos( '+', default_search_options''s_user_options)
804
805 -- Append +F or -R
806 if Minuspos > Pluspos then -- in searchoptions: the last option wins
807 'SearchDirection +'
808 'SayHint Changed search direction to: forward.'
809 else
810 'SearchDirection -'
811 'SayHint Changed search direction to: backward.'
812 endif
813
814; ---------------------------------------------------------------------------
815; Set SearchDirection to foreward (arg = 'F' or '+') or backward (arg = 'R'
816; or '-').
817defc SearchDirection
818 universal default_search_options
819
820 Direction = upcase( arg(1))
821 if Direction = '' then
822 return
823 elseif Direction = 'F' then
824 Direction = '+'
825 elseif Direction = 'R' then
826 Direction = '-'
827 endif
828
829 LastSearchArgs = GetLastSearchArgs()
830 s_delim = substr( LastSearchArgs, 1, 1) -- get 1st delimiter
831 parse value LastSearchArgs with (s_delim)s_search_string(s_delim)s_user_options
832 s_user_options = strip( s_user_options, 'T', s_delim)
833
834 LastChangeArgs = GetLastChangeArgs()
835 c_delim = substr( LastChangeArgs, 1, 1) -- get 1st delimiter
836 parse value LastChangeArgs with (c_delim)c_search_string(c_delim)c_replace_string(c_delim)c_user_options
837 c_user_options = strip( c_user_options, 'T', c_delim)
838
839 -- Remove every ( |+|-|F|R) from user_options
840 -- Note: translate doesn't allow '' as 4th parameter (pad).
841 rest = s_user_options
842 s_user_options = ''
843 do while rest <> ''
844 parse value rest with next 2 rest -- parse 1 char
845 if verify( upcase(next), ' +-FR', 'N') then -- if no match
846 s_user_options = s_user_options''next
847 endif
848 enddo
849 rest = c_user_options
850 c_user_options = ''
851 do while rest <> ''
852 parse value rest with next 2 rest -- parse 1 char
853 if verify( upcase(next), ' +-FR', 'N') then -- if no match
854 c_user_options = c_user_options''next
855 endif
856 enddo
857
858 -- Append +F or -R
859 if Direction = '+' then
860 s_user_options = s_user_options'+F'
861 c_user_options = c_user_options'+F'
862 elseif Direction = '-' then
863 s_user_options = s_user_options'-R'
864 c_user_options = c_user_options'-R'
865 endif
866
867 SearchArgs = s_delim''s_search_string''s_delim''s_user_options
868 ChangeArgs = c_delim''c_search_string''c_delim''c_replace_string''c_delim''c_user_options
869 -- Write new value only if old value was set
870 if LastSearchArgs <> '' & s_delim <> '' then
871 parse value LastSearchArgs with (s_delim)SearchString(s_delim)SearchOptions
872 if SearchOptions <> '' then
873 call SetLastSearchArgs( SearchArgs)
874 endif
875 endif
876 if LastChangeArgs <> '' & c_delim <> '' then
877 parse value LastChangeArgs with (c_delim)SearchString(c_delim)ReplaceString(c_delim)SearchOptions
878 if SearchOptions <> '' then
879 call SetLastChangeArgs( ChangeArgs)
880 endif
881 endif
882
883; ---------------------------------------------------------------------------
884defc FindNext
885 'SearchDirection +'
886 'RepeatFind'
887
888; ---------------------------------------------------------------------------
889defc FindPrev
890 'SearchDirection -'
891 'RepeatFind'
892
893; ---------------------------------------------------------------------------
894defc ChangeFindNext
895 'SearchDirection +'
896 'RepeatChange'
897 'RepeatFind'
898
899; ---------------------------------------------------------------------------
900defc ChangeFindPrev
901 'SearchDirection -'
902 'RepeatChange'
903 'RepeatFind'
904
905; ---------------------------------------------------------------------------
906defc RepeatFindAllFiles, RingFind
907
908 LastSearchArgs = GetLastSearchArgs()
909 delim = substr( LastSearchArgs, 1, 1) -- get 1st delimiter
910 parse value LastSearchArgs with (delim)search_string(delim)user_options
911 user_options = strip( user_options, 'T', delim)
912
913 -- Get current search direction
914 Minuspos = lastpos( '-', user_options)
915 Pluspos = lastpos( '+', user_options)
916 if Minuspos > Pluspos then
917 fForward = 0
918 else
919 fForward = 1
920 endif
921
922 -- Always search in entire files, not in mark
923 if pos( 'M', user_options) > 0 | pos( 'A', user_options) = 0 then
924 -- Remove 'M' from user_options
925 do forever
926 pv = verify( upcase( user_options), 'M', 'M')
927 if pv = 0 then
928 leave
929 endif
930 s_user_options = delstr( user_options, pv, 1)
931 enddo
932 -- Append 'A'
933 user_options = user_options'A'
934 call SetLastSearchArgs( delim''search_string''delim''user_options)
935 endif
936
937 -- Get LastSearchArgs from ini, remove 'T' and 'B' options
938 'RepeatFind'
939
940 if rc = 0 then
941 -- Next occurrence found in current file
942 return
943 endif
944
945 -- Not found in current file: search in other files
946 getfileid fid
947 startfid = fid
948 do forever
949
950 -- Next file
951 if fForward = 1 then
952 nextfile
953 else
954 prevfile
955 endif
956 getfileid fid
957 activatefile fid
958
959 call psave_pos( savedpos)
960 -- Start from top of file
961 if fForward = 1 then
962 top
963 .col = 1
964 else
965 bottom
966 endline
967 endif
968
969 -- Get LastSearchArgs from ini, remove 'T' and 'B' options
970 'RepeatFind'
971
972 if rc = 0 then
973 -- Found
974 'HookAdd selectonce postme postme HighlightMatch' -- additionally required to highlight after file switching
975 if fid = startfid then
976 'SayHint String only found in this file.'
977 else
978 sayerror 0 -- flush the message
979 endif
980 leave
981 else
982 -- Not found
983 call prestore_pos( savedpos)
984 if fid = startfid then
985 'SayError String not found in any file of the ring.'
986 leave
987 else
988 -- Search next file
989 endif
990 endif
991
992 enddo
993 activatefile fid
994
995; ---------------------------------------------------------------------------
996defc RepeatChangeAllFiles, RingChange
997 universal stay
998
999 LastChangeArgs = GetLastChangeArgs()
1000 delim = substr( LastChangeArgs, 1, 1) -- get 1st delimiter
1001 parse value LastChangeArgs with (delim)search_string(delim)replace_string(delim)user_options
1002 user_options = strip( user_options, 'T', delim)
1003 SavedOptions = user_options
1004
1005 -- Get current search direction
1006 Minuspos = lastpos( '-', user_options)
1007 Pluspos = lastpos( '+', user_options)
1008 if Minuspos > Pluspos then
1009 fForward = 0
1010 else
1011 fForward = 1
1012 endif
1013
1014 -- Always search in entire files, not in mark
1015 if pos( 'M', user_options) > 0 | pos( 'A', user_options) = 0 then
1016 -- Remove 'M' from user_options
1017 do forever
1018 pv = verify( upcase( user_options), 'M', 'M')
1019 if pv = 0 then
1020 leave
1021 endif
1022 user_options = delstr( user_options, pv, 1)
1023 enddo
1024 -- Append 'A'
1025 user_options = user_options'A'
1026 endif
1027
1028 -- Replace all occurrences, not only next
1029 if pos( '*', user_options) = 0 then
1030 -- Append '*'
1031 user_options = user_options'*'
1032 endif
1033
1034 -- Write LastChangeArgs to ini
1035 if user_options <> SavedOptions then
1036 call SetLastChangeArgs( delim''search_string''delim''replace_string''delim''user_options)
1037 endif
1038
1039 getfileid fid
1040 startfid = fid
1041 ChangeCount = 0
1042 do forever
1043
1044 call psave_pos( savedpos)
1045 -- Start from top of file
1046 if fForward = 1 then
1047 top
1048 .col = 1
1049 else
1050 bottom
1051 endline
1052 endif
1053
1054 -- Get LastChangeArgs from ini, remove 'T' and 'B' options
1055 'RepeatChange'
1056
1057 if rc = 0 then
1058 -- Found
1059 ChangeCount = ChangeCount + 1
1060 if stay then
1061 call prestore_pos( savedpos)
1062 endif
1063 else
1064 -- Not found
1065 call prestore_pos( savedpos)
1066 endif
1067
1068 -- Next file
1069 if fForward = 1 then
1070 nextfile
1071 else
1072 prevfile
1073 endif
1074
1075 getfileid fid
1076 if fid = startfid then
1077 leave
1078 endif
1079
1080 enddo
1081
1082 if ChangeCount = 1 then
1083 files = 'file.'
1084 else
1085 files = 'files.'
1086 endif
1087 'SayHint String changed in' ChangeCount files
1088
1089; ---------------------------------------------------------------------------
1090defc FindNextAllFiles
1091 'SearchDirection F'
1092 'RepeatFindAllFiles'
1093
1094; ---------------------------------------------------------------------------
1095defc FindPrevAllFiles
1096 'SearchDirection R'
1097 'RepeatFindAllFiles'
1098
1099; ---------------------------------------------------------------------------
1100defc FindMark
1101 if FileIsMarked() then
1102 -- Get active mark coordinates and fileid
1103 getmark first_line, last_line, first_col, last_col, mark_fileid
1104 if last_line <> first_line then
1105 -- Take up to one line
1106 last_line = first_line
1107 endline
1108 last_col = .col
1109 endif
1110 searchstring = substr( textline( first_line ), first_col, last_col - first_col + 1)
1111 if searchstring <> '' then
1112 'l '\1''searchstring
1113 endif
1114 else
1115 sayerror -280 -- Text not marked
1116 endif
1117
1118; ---------------------------------------------------------------------------
1119; Find word under cursor -- if arg(1) > 0: -- under pointer.
1120defc FindWord
1121 -- If arg(1) specified and > 0: Set cursor to pos of pointer.
1122 if arg(1) then
1123 'MH_gotoposition'
1124 endif
1125 lrc = 1
1126 startline = .line
1127 startcol = .col
1128 call pend_word()
1129 lastcol = .col
1130 call pbegin_word()
1131 firstcol = .col
1132 -- Start search after current word
1133 .col = lastcol + 1
1134 searchstring = substr( textline( startline), firstcol, lastcol - firstcol + 1)
1135 if searchstring <> '' then
1136 'l '\1''searchstring
1137 lrc = rc
1138 endif
1139 if lrc <> 0 then
1140 .col = startcol
1141 endif
1142
1143; ---------------------------------------------------------------------------
1144; Moved from MOUSE.E
1145; Find identifier under cursor -- if arg(1) > 0: -- under pointer.
1146defc FindToken
1147 -- If arg(1) specified and > 0: Set cursor to pos of pointer.
1148 if arg(1) then
1149 'MH_gotoposition'
1150 endif
1151 lrc = 1
1152 call psave_pos( savedpos)
1153 if find_token( startcol, endcol) then
1154 -- find_token returns first and last col of the found string. Therefore
1155 -- search shall start from 1 col behind.
1156 .col = endcol + 1
1157 -- The standard cmd 'locate' won't set standard rc. The standard 'locate'
1158 -- always returns rc = ''.
1159 -- Standard commands that don't change rc (are there more?):
1160 -- 'locate', 'edit'
1161 -- This is fixed in NEPMD.
1162 -- The standard commands 'quit', 'save', 'name',... do change rc.
1163 -- Therefore 'locate' now calls the proc locate, that sets rc correctly.
1164 -- rc is the rc from 'xcom locate'.
1165 -- (rc is a universal var, that doesn't need the universal definition.)
1166 'l '\1''substr( textline( .line), startcol, (endcol - startcol) + 1)
1167 lrc = rc
1168 endif
1169 --sayerror 'defc findword: lrc = 'lrc
1170 if lrc <> 0 then -- if not found
1171 call prestore_pos( savedpos)
1172 endif
1173
1174; ---------------------------------------------------------------------------
1175; Find a token around the cursor.
1176defproc find_token( var startcol, var endcol)
1177 if arg(3) = '' then
1178 token_separators = ' ~`!%^&*()-+=][{}|\:;?/><,''"'\t
1179 else
1180 token_separators = arg(3)
1181 endif
1182 if arg(4) = '' then
1183 diads = '-> ++ -- << >> <= >= && || += -= *= /= %= ª= &= |= :: /* */'
1184 else
1185 diads = arg(4)
1186 endif
1187 getline line
1188 len = length( line)
1189 if .col > len | pos( substr( line, .col, 1), ' '\t) then
1190 -- Past end of line, or over whitespace
1191 return
1192 endif
1193 endcol = verify( line, token_separators, 'M', .col)
1194 if endcol = .col then
1195 -- On an operator
1196 startcol = endcol
1197 if wordpos( substr( line, startcol, 2), diads) then
1198 -- On first character
1199 endcol = endcol + 1
1200 elseif .col > 1 then
1201 if wordpos( substr( line, endcol-1, 2), diads) then
1202 -- On last character
1203 startcol = startcol - 1
1204 endif
1205 endif
1206 return 2
1207 endif
1208 if endcol then
1209 endcol = endcol - 1
1210 else
1211 endcol = len
1212 endif
1213 startcol = verify( reverse( line), token_separators, 'M', len - .col + 1)
1214 if startcol then
1215 startcol = len - startcol + 2
1216 else
1217 startcol = 1
1218 endif
1219 return 1
1220
1221; ---------------------------------------------------------------------------
1222defc ShowSearch
1223 getsearch cursearch
1224
1225 Next = 'Last search = ['cursearch'], last search args = ['GetLastSearchArgs()']' ||
1226 ', last change args = ['GetLastChangeArgs()']'
1227 'SayHint' Next
1228 dprintf( Next)
1229
1230; ---------------------------------------------------------------------------
1231defc SetScrollAfterLocate
1232 KeyPath = '\NEPMD\User\CursorPos\ScrollAfterLocate'
1233 -- if executed with a num as arg
1234 if arg(1) <> '' & isnum(arg(1)) then
1235 call WriteConfigKey( KeyPath, arg(1))
1236 if isadefproc( 'MenuText_scrollafterlocate') then
1237 MenuText_scrollafterlocate()
1238 endif
1239 return
1240 endif
1241 -- else open entrybox
1242 Title = 'Configure line position on screen after locate'
1243 Text = 'Enter number of lines from top or bottom.'
1244 IniValue = QueryConfigKey( KeyPath)
1245 If IniValue = 0 | IniValue = '' then
1246 DefaultButton = 3
1247 elseif IniValue < 0 then
1248 DefaultButton = 2
1249 else
1250 DefaultButton = 1
1251 endif
1252 -- strip + or -
1253 IniValue = translate( IniValue, ' ', '+-')
1254 IniValue = strip(IniValue)
1255 parse value entrybox( Title,
1256 '/# from ~top/# from ~bottom/~Center/Cancel', -- max. 4 buttons
1257 IniValue,
1258 '',
1259 260,
1260 atoi(DefaultButton) ||
1261 atoi(0000) || -- help id
1262 gethwndc(APP_HANDLE) ||
1263 Text) with Button 2 NewValue \0
1264 -- strip + or -
1265 NewValue = translate( NewValue, ' ', '+-')
1266 NewValue = strip(NewValue)
1267 parse value NewValue with NewValue .
1268 if Button = \1 then
1269 'SetScrollAfterLocate' NewValue
1270 return
1271 elseif Button = \2 then
1272 'SetScrollAfterLocate -'NewValue
1273 return
1274 elseif Button = \3 then
1275 'SetScrollAfterLocate 0'
1276 return
1277 elseif Button = \4 then
1278 return
1279 endif
1280
1281; ---------------------------------------------------------------------------
1282defc GotoLineDlg
1283 Title = 'Go to line'
1284 Text = 'Enter line number and optionally a column number:'
1285 --Text = Text''copies( ' ', max( 100 - length(Text), 0))
1286 Entry = ''
1287 parse value entrybox( Title,
1288 '',
1289 Entry,
1290 0,
1291 240,
1292 atoi(1) || atoi(0) || atol(0) ||
1293 Text) with button 2 NewLine \0
1294 NewLine = strip( NewLine)
1295 if button = \1 & NewLine <> '' then
1296 'goto' NewLine
1297 endif
1298
1299; ---------------------------------------------------------------------------
1300const
1301compile if not defined( MATCH_MAX_LINES)
1302 MATCH_MAX_LINES = 200
1303compile endif
1304compile if not defined( MATCH_MAX_LOOPS)
1305 MATCH_MAX_LOOPS = 50
1306compile endif
1307
1308defproc Match( OpenStr)
1309 universal CurKey
1310 universal PrevKey
1311 universal PrevMatchData
1312
1313 StartLine = .line
1314 StartCol = .col
1315 ThisLine = ''
1316 OpenLine = 0
1317 OpenCol = 0
1318 lrc = 1
1319
1320 CloseStr = arg(2)
1321/*
1322 if CloseStr <> '' then
1323 call NextCmdAltersText()
1324 -- Type the char
1325 call Process_Keys( CloseStr)
1326 endif
1327*/
1328 fSearch = 1
1329 -- Omit search for repeated keys after an unsuccessful search
1330 getfileid Fid
1331 parse value PrevMatchData with PrefFid PrevLine PrevRc
1332 do i = 1 to 1
1333 if CloseStr = '' then
1334 leave
1335 elseif PrevRc = 0 then
1336 leave
1337 elseif PrefFid PrevLine <> Fid StartLine then
1338 leave
1339 elseif CurKey <> PrevKey then
1340 leave
1341 else
1342 fSearch = 0
1343 lrc = PrevRc
1344 --dprintf( 'Omit search, prev. rc = 'PrevRc)
1345 endif
1346 enddo
1347
1348 if fSearch then
1349 display -3 -- turn off non-critical error messages and screen updates
1350 -- Note: SayHint uses temp. 'display -8' to disable message box saving.
1351 -- That results in 'display -11'.
1352 call psave_pos( ScreenPos)
1353 sayerror 0
1354
1355 lrc = passist( 0, MATCH_MAX_LINES, MATCH_MAX_LOOPS)
1356 if not lrc then
1357 getline ThisLine
1358 OpenLine = .line
1359 OpenCol = .col
1360 endif
1361
1362 call prestore_pos( ScreenPos)
1363 display 3 -- turn on non-critical error messages and screen updates
1364 PrevBalanceData = Fid StartLine lrc
1365
1366 if lrc then
1367 -- Let passist do the error msg
1368 elseif OnScreen( OpenLine, OpenCol) then
1369 -- Highlight it
1370 EndCol = OpenCol + length( OpenStr) - 1
1371 'PostMe CircleIt' OpenLine OpenCol EndCol
1372 else
1373 -- Opening character not on screen, so tell user in message area where it is
1374 ReportLine = leftstr( ThisLine, OpenCol + length( OpenStr) - 1)
1375 if (length( ReportLine) > 20) then
1376 ReportLine = leftstr( ReportLine, 20) "..."
1377 endif
1378 'SayHint Line' OpenLine', column' OpenCol':' ReportLine
1379 endif
1380 endif
1381
1382 return lrc
1383
1384; ---------------------------------------------------------------------------
1385defc Match
1386 rc = Match( arg(1))
1387
Note: See TracBrowser for help on using the repository browser.