controlling search in VED in Poplog V14.5 
Author Message
 controlling search in VED in Poplog V14.5

Having been very annoyed for the ump{*filter*}th time by the new behaviour
in VED's search regarding wrap/nowrap, I now have devised the following
solution, which may be of use to others.

It works on the assumption that the active variable ved_search_state
holds 9 objects of which the third is a boolean that determines whether
wrapping round the end of the file is allowed or not allowed.
Unfortunately this is based on trial and error, as the documentation in
REF VEDSEARCH does not provide the information. So I am not sure whether
my solution is guaranteed to work in all contexts.

Does anyone know?

Objective: to make the "repeat" search key sequences work as documented
in TEACH VEDSEARCH, i.e.
=======================================================================
-- Repeat forward search: <ESC> / --------------------------------------

The sequence <ESC> /  can be used to repeat the last search. It will
use the last search string to search forward like <ENTER> / and
<ENTER> ".

-- Repeat backward search: <ESC> \ ------------------------------------

This is exactly like <ESC> /  except that it searches backwards and does
not wrap around the top of the file.
=======================================================================

There are two things wrong with the current version (compared with the
previous behaviour and the above documentation):
    (a) backward search using "ESC \" DOES wrap by default
    (b) forward search using "ESC /" will NOT wrap if the last
        search command explicitly used the no-wrap option.

The following procedure overcomes this. It can be used to "re_search",
i.e. search again using the previous search string, either forward or
backward, but ensuring that forward search wraps and backward search
doesn't. vedsetkey is then used to change the behaviour of "ESC /" and
"ESC \".

define vednew_re_search(forward);
    ;;; Search forward or backward, using previous search state
    ;;; settings, except that forward search always wraps and backward
    ;;; search never does

    lvars forward;  ;;; a boolean

    lconstant search_items = 9,
        search_vector = initv(search_items);

    ;;; save the contents of ved_search_state in the vector
    fill(ved_search_state, search_vector)->;
    if forward then
        ;;; allow wrapping by setting third item of state true
        true -> search_vector(3);
        explode(search_vector) -> ved_search_state;
        ved_re_search();
    else
        ;;; prevent wrapping
        false -> search_vector(3);
        explode(search_vector) -> ved_search_state;
        ved_re_backsearch();
    endif;
    ;;; re-set contents of vector
    set_subvector(0, 1, search_vector, search_items)
enddefine;

;;; search forward, using the  wrap default.
vedsetkey('\^[/', vednew_re_search(%true%));    ;;; ESC /

;;; search back, using the no wrap default.
vedsetkey('\^[\\', vednew_re_search(%false%));  ;;; ESC \
=======================================================================

Aaron



Thu, 23 Oct 1997 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ved search and replace in poplog v14.5 (PS)

2. ved search and replace in poplog v14.5 (PS)

3. ved search and replace in poplog v14.5

4. Search and Replace Problems in the new VED in V14.5

5. Running Ved from Ved

6. Help! Controlling ved with ml

7. Using search tool on function or control pallette causes Labview to close

8. I search a driver for an instrument Bruel&Kjaer 1050 ( vibration Exciter Control)

9. efficiency question-controlling a search

10. Syntactic errors when compiling from a ved buffer

11. making the world safe for ved

12. ved and rxvt (Boring)

 

 
Powered by phpBB® Forum Software