Changeset 3734


Ignore:
Timestamp:
Dec 7, 2019, 2:43:57 PM (5 years ago)
Author:
Andreas Schnellbacher
Message:
  • Fixed search direction processing on changing between search dialog and search commands or keys. Previously, a backward search is executed after Sh+F3 and pressing the 'Find' button of the search dialog, even when the 'Reverse search' check box wans't checked.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/netlabs/macros/locate.e

    r3649 r3734  
    264264   fOnlyDirectionChanged = 0
    265265   do once = 1 to 1
    266       -- Remove FR+- from LastOpts and NextOpts for comparison
     266      -- Remove FR+-D from LastOpts and NextOpts for comparison
    267267      -- with LastSearchOptions and SearchOptions
    268268      LastOpts = LastSearchOptions
    269269      do forever
    270          pv = verify( LastOpts, 'FR+-', 'M')
     270         pv = verify( LastOpts, 'FR+-D', 'M')
    271271         if pv = 0 then
    272272            leave
     
    276276      NextOpts = SearchOptions
    277277      do forever
    278          pv = verify( NextOpts, 'FR+-', 'M')
     278         pv = verify( NextOpts, 'FR+-D', 'M')
    279279         if pv = 0 then
    280280            leave
     
    484484
    485485   if not fSearch then
    486       return  - 1
     486      return  -1
    487487   else
    488488      return FilteredSearchOptions
     
    572572
    573573; ---------------------------------------------------------------------------
     574defproc GetLastSearchDialogOptions
     575   KeyPath = '\NEPMD\Var\Search\LastSearchDialogOptions'
     576   LastSearchDialogOptions = QueryConfigKey( KeyPath)
     577   --dprintf( 'GetLastSearchDialogOptions: LastSearchDialogOptions = 'LastSearchDialogOptions)
     578   return LastSearchDialogOptions
     579
     580; ---------------------------------------------------------------------------
    574581defproc SetLastSearchArgs
    575582   KeyPath = '\NEPMD\Var\Search\LastSearchArgs'
     
    584591   LastChangeArgs = arg( 1)
    585592   call WriteConfigKey( KeyPath, LastChangeArgs)
     593   return
     594
     595; ---------------------------------------------------------------------------
     596defproc SetLastSearchDialogOptions
     597   KeyPath = '\NEPMD\Var\Search\LastSearchDialogOptions'
     598   LastSearchDialogOptions = arg( 1)
     599   call WriteConfigKey( KeyPath, LastSearchDialogOptions)
     600   --dprintf( 'SetLastSearchDialogOptions: LastSearchDialogOptions = 'LastSearchDialogOptions)
    586601   return
    587602
     
    617632   LastSearchArgs = GetLastSearchArgs()
    618633   LastChangeArgs = GetLastChangeArgs()
     634   LastSearchDialogOptions = GetLastSearchDialogOptions()
    619635
    620636   args = strip( arg( 1), 'L')
     637
     638   -- Filter out 'D' arg from search dialog for RepeatFind
     639   fDialogRepeat = 0
     640   if args = \1\1\1\1'D' then
     641      fDialogRepeat = 1
     642      args = ''
     643   endif
     644
     645   -- Handle RepeatFind
    621646   if args = '' then  -- If no args, query args
    622       args = LastSearchArgs
     647      SearchArgs = LastSearchArgs
     648
     649      tmpdelim = substr( SearchArgs, 1, 1)  -- get 1st delimiter
     650      parse value SearchArgs with (tmpdelim)SearchString(tmpdelim)SearchOptions
     651      next = SearchOptions
     652
     653      -- Ensure that option D is removed if not coming from the search dialog
     654      if not fDialogRepeat then
     655         do forever
     656            Dpos = pos( 'D', next)
     657            if Dpos = 0 then
     658               leave
     659            endif
     660            next = delstr( next, Dpos, 1)
     661         enddo
     662      endif
     663      -- Ensure that last options from the dialog are used, not from elsewhere
     664      if fDialogRepeat then
     665         next = LastSearchDialogOptions
     666      endif
     667
     668      -- Rebuild SearchArgs
     669      SearchOptions = next
     670      SearchArgs = tmpdelim''SearchString''tmpdelim''SearchOptions
     671
     672      args = SearchArgs
    623673      -- Process the parsing of args again to recognize a possible change of
    624674      -- default_search_options in the meantime.
     
    628678   parse value args with (delim)SearchString(delim)UserOptions
    629679   UserOptions = strip( UserOptions, 'T', delim)
     680
    630681   AddSearchChangeOptions = GetAddSearchChangeOptions()
    631682   UserOptions = UserOptions''AddSearchChangeOptions
     
    649700   SearchArgs = delim''SearchString''delim''SearchOptions
    650701   --dprintf( overlay( ' Locate ', copies( '-', 60), 4))
    651    --dprintf( '--- SearchArgs = 'SearchArgs', arg( 1) = 'arg( 1))
    652    --dprintf( 'LastSearchArgs = 'LastSearchArgs)
     702   --dprintf( '--- SearchArgs = 'SearchArgs', arg( 1) = 'arg( 1)', fDialogRepeat = 'fDialogRepeat)
     703   --dprintf( 'LastSearchArgs = 'LastSearchArgs', LastSearchDialogOptions = 'LastSearchDialogOptions)
    653704
    654705   parse value lastsearchpos with LastLine LastCol LastFid LastSearchLen LastSearchMode LastSearchRc
     
    676727   -- Save last and cur args
    677728   call SetLastSearchArgs( SearchArgs)
     729   if pos( 'D', SearchOptions) then
     730      call SetLastSearchDialogOptions( SearchOptions)
     731   endif
    678732
    679733   if SearchString = cSearchString then
     
    778832   LastSearchArgs = GetLastSearchArgs()
    779833   LastChangeArgs = GetLastChangeArgs()
     834   LastSearchDialogOptions = GetLastSearchDialogOptions()
    780835
    781836   args = strip( arg( 1), 'L')
     837
     838   -- Filter out 'D' arg from search dialog for RepeatChange
     839   fDialogRepeat = 0
     840   if args = \1\1\1\1'D' then
     841      fDialogRepeat = 1
     842      args = ''
     843   endif
     844
     845   -- Handle RepeatChange
    782846   if args = '' then   -- If no args, query lastchangeargs
    783       args = LastChangeArgs
     847      ChangeArgs = LastChangeArgs
     848
     849      tmpdelim = substr( ChangeArgs, 1, 1)  -- get 1st delimiter
     850      parse value ChangeArgs with (tmpdelim)SearchString(tmpdelim)ReplaceString(tmpdelim)SearchOptions
     851      next = SearchOptions
     852
     853      -- Ensure that option D is removed if not coming from the search dialog
     854      if not fDialogRepeat then
     855         do forever
     856            Dpos = pos( 'D', next)
     857            if Dpos = 0 then
     858               leave
     859            endif
     860            next = delstr( next, Dpos, 1)
     861         enddo
     862      endif
     863      -- Ensure that last options from the dialog are used, not from elsewhere
     864      if fDialogRepeat then
     865         next = LastSearchDialogOptions
     866      endif
     867
     868      -- Rebuild LastChangeArgs
     869      SearchOptions = next
     870      ChangeArgs = tmpdelim''SearchString''tmpdelim''ReplaceString''tmpdelim''SearchOptions
     871
     872      args = ChangeArgs
    784873      -- Process the parsing of args again to recognize a possible change of
    785874      -- default_search_options in the meantime.
     
    799888   parse value args with (delim)SearchString(delim)ReplaceString(delim)UserOptions
    800889   UserOptions = strip( UserOptions, 'T', delim)
     890
    801891   AddSearchChangeOptions = GetAddSearchChangeOptions()
    802892   UserOptions = UserOptions''AddSearchChangeOptions
     
    826916   SearchArgs = delim''SearchString''delim''SearchOptions
    827917   --dprintf( overlay( ' Change ', copies( '-', 60), 4))
    828    --dprintf( '--- ChangeArgs = 'ChangeArgs', arg( 1) = 'arg( 1))
     918   --dprintf( '--- ChangeArgs = 'ChangeArgs', arg( 1) = 'arg( 1)', fDialogRepeat = 'fDialogRepeat)
    829919   --dprintf( '--- SearchArgs = 'SearchArgs', arg( 1) = 'arg( 1))
    830    --dprintf( 'LastChangeArgs = 'LastChangeArgs', LastSearchArgs = 'LastSearchArgs)
     920   --dprintf( 'LastChangeArgs = 'LastChangeArgs', LastSearchArgs = 'LastSearchArgs', LastSearchDialogOptions = 'LastSearchDialogOptions)
    831921
    832922   -- Save last args
    833923   call SetLastChangeArgs( ChangeArgs)
    834924   call SetLastSearchArgs( SearchArgs)
     925   if pos( 'D', SearchOptions) then
     926      call SetLastSearchDialogOptions( SearchOptions)
     927   endif
    835928
    836929   SearchMode = 'c'
     
    11751268
    11761269   if uparg = 'C' then
    1177       'RepeatChange'
     1270      'RepeatChange '\1\1\1\1'D'
    11781271   elseif uparg = 'F' then
    1179       'RepeatFind'
     1272      'RepeatFind '\1\1\1\1'D'
    11801273
    11811274   else
Note: See TracChangeset for help on using the changeset viewer.