Changeset 4262


Ignore:
Timestamp:
Oct 31, 2020, 9:09:12 AM (4 years ago)
Author:
Andreas Schnellbacher
Message:
  • Fixed FindStringInCode: If comments have to be ignored, the scroll pos. was wrong.
File:
1 edited

Legend:

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

    r4244 r4262  
    24282428   --dprintf( 'FindStrInCode: arg( 1) = 'arg( 1)', .filename = '.filename)
    24292429
    2430    -- Reset last search args to always execute a fresh search and not a
    2431    -- find-next. Otherwise the t option would be removed.
    2432    call SetLastSearchArgs( '')
     2430   call pSave_Pos( savedpos)
     2431
     2432   fCaseSensitive = QueryModeKey( Mode, 'CaseSensitive')
     2433   if fCaseSensitive = 0 then
     2434      CaseOpt = 'c'  -- ignore
     2435   else
     2436      CaseOpt = 'e'  -- exact
     2437   endif
    24332438
    24342439   -- First try word search
    2435    'l '\1''SearchStr''\1'wt+fac'
    2436    --dprintf( 'FindStrInCode: l '\1''SearchStr''\1'wt+fac, rc = 'rc)
     2440   'xcom l '\1''SearchStr''\1'wt+fa'CaseOpt
     2441   --dprintf( 'FindStrInCode: xcom l '\1''SearchStr''\1'wt+fa'CaseOpt', rc = 'rc)
    24372442
    24382443   -- If nothing found, try normal search
    24392444   if rc then
    2440       'l '\1''SearchStr''\1't+fac'
     2445      'xcom l '\1''SearchStr''\1't+fa'CaseOpt
    24412446   endif
    24422447
     
    24452450      -- Check for comments. Strings are valid if a cmd is searched.
    24462451      if InsideComment( Mode) then
    2447          repeatfind
     2452
     2453         -- Search again
     2454         repeatfind  -- This works also with for xcom l and option t
    24482455         if rc then
    24492456            leave
    2450          -- Recognize an inifinite loop
     2457         -- Recognize an infinite loop
    24512458         elseif .line .col = PrevPos then
    24522459            leave
    24532460         endif
     2461
    24542462         PrevPos = .line .col
    24552463         iterate
     
    24582466      leave
    24592467   enddo
    2460 
     2468   lrc = rc
     2469   call pSave_Pos( lpos)
     2470
     2471   if not lrc then
     2472      -- This proc is often used for newly-loaded files. It opens the file
     2473      -- without a dialog in the way. Therefore better center the found
     2474      -- line.
     2475      call ScrollAfterLocate( savedpos, lpos, '', 'C C')
     2476   endif
     2477
     2478
Note: See TracChangeset for help on using the changeset viewer.