home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
wp
/
bmacs.zip
/
SRCHHILT.M
< prev
next >
Wrap
Text File
|
1989-01-01
|
3KB
|
94 lines
;***************************************************************************
;**
;** These macros can be used to improve the way that Brief handles
;** search targets. The macro highlight_searched can be called after
;** a search and will highlight the target if it is found. The highlight
;** will disappear when the user enters the first keystroke. This is very
;** useful if you are using an EGA in 43 line mode as it is sometimes hard
;** to find the cursor in a screen full of characters.
;** As a side comment, it would be VERY useful if ALL Brief macros returned
;** some status value that indicated success or failure. In this way they
;** become useful primitives for building higher level functions. This is
;** NOT done by the search and translate macros in SEARCH.M.
;**
;** Written for Brief v1.33 by Harold Handelsman, 22 Sept 1986
;**
;***************************************************************************
;**
;** local_search_again
;**
;** This routine will repeat the last search and highlight the text
;** if it was found. This should be assigned to Shift-F6 instead of
;** search_again. Similar routine can be made for kbd_fwd_search and
;** kbd_backward_search.
;**
(macro local_search_again
(
(search_again)
(highlight_searched)
)
)
;**
;** highlight_searched
;**
;** This routine will highlight the text if it was found, then wait
;** for the next keystroke. When the user types the next command, the
;** highlight is removed and the keystroke is then pushed back into
;** the buffer.
;**
(macro highlight_searched
(
(int ln)
(string st)
;** Find the length of the search string.
(= ln (strlen _s_pat))
;** Check if the search pattern has been specified.
(if ln
(
;** Read the rest of the current line into a string.
(= st (read))
;** If the target string is found then highlight it.
;** (Note: search_string is always case sensitive and
;** so will not always find the target.)
(if (search_string _s_pat st ln (! _reg_exp))
(
;** Move to the end of the target string.
(move_rel 0 (- ln 1))
(drop_anchor)
;** Now move to the start of the string.
(move_rel 0 (- 1 ln))
;** Refresh to update the cursor position and wait for
;** the user to type a command.
(refresh)
(while (== (= ln (read_char)) -1))
;** Now delete the highlight and push the command back into
;** the buffer.
(raise_anchor)
(push_back ln)
)
)
)
)
)
)