Loading ...
Sorry, an error occurred while loading the content.

Line hilighting extension for a region

Expand Messages
  • Jon Green
    Below are details to extend the line hilighting (Right mouse - Hilight Line). The extensions allow a region to be hilighted. The basic operation is defined as
    Message 1 of 1 , Feb 23, 2003
    • 0 Attachment
      Below are details to extend the line hilighting
      (Right mouse -> Hilight Line). The extensions
      allow a region to be hilighted.

      The basic operation is defined as follows:-
      a) On a line with no region
      -> Hilight line only.
      b) Active selected text contained on a single line
      -> Search for all lines containing selected
      text and hilight.
      c) Active selected text spanning multiple lines
      -> Hilight all lines in region.

      Option (c) is the new behaviour, to implement
      then edit "search.emf" as follows:-

      Add macro "hilight-region-text"
      Edit macro "line-scheme"

      Macro details below, may need to correct for
      mail line wrapping, should be fairly obvious.
      Note that the region computation is performed
      first so that the selected region is maintained
      if there is no multi-line region defined, the
      rest of the macro then behaves as it did before
      with no changes.

      Jon.
      --
      0 define-macro hilight-region-text
      0 show-region
      !if &equ &band $result 5 5
      !if ¬ &band $result 2
      3 show-region
      !endif
      set-position "\x81"
      -2 show-region
      set-variable #l1 $window-line
      2 show-region
      set-variable #l2 $window-line
      ; If the lines are equal then quit now.
      !if &equ #l1 #l2
      ; Failed - Reactivate the region that is active.
      goto-position "\x81"
      !force 4 show-region
      !abort
      !endif
      ; Set up for a hilighting operation.
      set-variable #l8 &lget .osd-search.hilschms @#
      set-variable #l8 &cond &equ #l8 $global-scheme -1 #l8
      ; Compute the top line.
      !if &gre #l1 #l2
      set-variable #l0 #l2
      set-variable #l2 #l1
      set-variable #l1 #l0
      !else
      -2 show-region
      !endif
      ; Hilight all of the lines in the region.
      !repeat
      !if ¬ &or &equ $line-scheme .scheme.fold &equ
      $line-scheme .scheme.fold-open
      ; just do current line - Protect folded lines.
      set-variable $line-scheme #l8
      !endif
      !force forward-line
      set-variable #l1 &add #l1 1
      !until &gre #l1 #l2
      ; Knock off all of the region stuff and resume first position.
      !force -3 show-region
      !force 3 show-region
      !force -1 show-region
      goto-position "\x81"
      !return
      !endif
      !abort
      !emacro

      ; line-scheme & osd-line-scheme external interfaces, used by the
      multi-menu code
      define-macro line-scheme
      !if @?
      ; See if this is a region hilight operation, if so then do it
      ; immediately before search-get-region-text destroys the region
      ; information. Returns TRUE if a region has been hilighted.
      !force @# hilight-region-text
      !if $status
      !return
      !endif
      ; @# is a scheme number (1 == remove), if text is hilighted
      ; the search all buffer for it and hilight, else just do
      current line
      !force 0 search-get-region-text
      !if $status
      ; if some text is hilighted, use that as the search string
      set-variable #l0 .osd-search.search
      set-variable #l1 .osd-search.scheme
      set-variable .osd-search.search #l9
      set-variable .osd-search.scheme @#
      !force !force 5 osd-search-hilight
      set-variable .osd-search.search #l0
      set-variable .osd-search.scheme #l1
      !elif ¬ &or &equ $line-scheme .scheme.fold &equ $line-scheme
      .scheme.fold-open
      ; just do current line - Protect folded lines.
      set-variable #l8 &lget .osd-search.hilschms @#
      set-variable #l8 &cond &equ #l8 $global-scheme -1 #l8
      set-variable $line-scheme #l8
      !endif
      !else
      ; remove all hilighting
      osd-search-hilight
      !endif
      !emacro


      Differences on File "search.emf"
      --------------------------------

      cd c:/me/macros/
      cvs diff -c -w

      ? .ziplist
      ? memacros.tar.gz
      cvs server: Diffing .
      Index: search.emf
      ===================================================================
      RCS file: /home/cvs/cvsroot/me/macros/search.emf,v
      retrieving revision 2.8
      diff -c -w -r2.8 search.emf
      *** search.emf 26 Jan 2003 15:06:07 -0000 2.8
      --- search.emf 23 Feb 2003 15:18:41 -0000
      ***************
      *** 486,491 ****
      --- 486,538 ----
      !abort
      !emacro

      + 0 define-macro hilight-region-text
      + 0 show-region
      + !if &equ &band $result 5 5
      + !if ¬ &band $result 2
      + 3 show-region
      + !endif
      + set-position "\x81"
      + -2 show-region
      + set-variable #l1 $window-line
      + 2 show-region
      + set-variable #l2 $window-line
      + ; If the lines are equal then quit now.
      + !if &equ #l1 #l2
      + ; Failed - Reactivate the region that is active.
      + goto-position "\x81"
      + !force 4 show-region
      + !abort
      + !endif
      + ; Set up for a hilighting operation.
      + set-variable #l8 &lget .osd-search.hilschms @#
      + set-variable #l8 &cond &equ #l8 $global-scheme -1 #l8
      + ; Compute the top line.
      + !if &gre #l1 #l2
      + set-variable #l0 #l2
      + set-variable #l2 #l1
      + set-variable #l1 #l0
      + !else
      + -2 show-region
      + !endif
      + ; Hilight all of the lines in the region.
      + !repeat
      + !if ¬ &or &equ $line-scheme .scheme.fold &equ
      $line-scheme .scheme.fold-open
      + ; just do current line - Protect folded lines.
      + set-variable $line-scheme #l8
      + !endif
      + !force forward-line
      + set-variable #l1 &add #l1 1
      + !until &gre #l1 #l2
      + ; Knock off all of the region stuff and resume first position.
      + !force -3 show-region
      + !force 3 show-region
      + !force -1 show-region
      + goto-position "\x81"
      + !return
      + !endif
      + !abort
      + !emacro

      osd .osd.sar-srl 00 "s" 30 11 -1 -1
      osd .osd.sar-srl 10 "Sf" "&Search for" 20
      ***************
      *** 634,639 ****
      --- 681,693 ----
      ; line-scheme & osd-line-scheme external interfaces, used by the
      multi-menu code
      define-macro line-scheme
      !if @?
      + ; See if this is a region hilight operation, if so then do it
      + ; immediately before search-get-region-text destroys the region
      + ; information. Returns TRUE if a region has been hilighted.
      + !force @# hilight-region-text
      + !if $status
      + !return
      + !endif
      ; @# is a scheme number (1 == remove), if text is hilighted
      ; the search all buffer for it and hilight, else just do
      current line
      !force 0 search-get-region-text
      [EXIT]
    Your message has been successfully submitted and would be delivered to recipients shortly.