Changeset 3222


Ignore:
Timestamp:
Oct 27, 2018, 4:43:44 PM (6 years ago)
Author:
Andreas Schnellbacher
Message:
  • Undo: Improved parameter checking again to avoid trying to restore a position if prestore_pos args are empty.
File:
1 edited

Legend:

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

    r3212 r3222  
    218218      next = GetAvar( fid'.'SelectedState'.undostatepos')
    219219      --dprintf( 'SelectUndo: 'fid'.'SelectedState'.undostatepos = 'next)
    220 
    221220      parse value next with savepos'|'savemark
     221      parse value savepos with svline svcol svcx svcy
     222
     223      NextState = SelectedState + 1
     224      next = GetAvar( fid'.'NextState'.undostatepos')
     225      parse value next with nextpos'|'.
     226      parse value nextpos with nextline nextcol nextcx nextcy
    222227
    223228      if SelectedState < PrevState then
    224229         -- Better keep scroll pos. of NextState then
    225          NextState = SelectedState + 1
    226          next = GetAvar( fid'.'NextState'.undostatepos')
    227          parse value next with nextpos'|'.
    228          parse value nextpos with nextline nextcol nextcx nextcy
    229230         -- Check parameters
    230231         if nextcx <> '' & nextcy <> '' then
    231232            -- Rebuild savepos string
    232             parse value savepos with svline svcol svcx svcy
    233233            -- Use line and col of SelectedState
    234             savepos =  svline svcol nextcx nextcy
     234            savepos = svline svcol nextcx nextcy
    235235         endif
    236236      endif
    237237
    238       if savepos = '' then
    239          -- Better don't change cursor pos. then
    240       else
    241          --dprintf( 'SelectUndo: prestore_pos_min_scroll( 'savepos')')
    242          call prestore_pos_min_scroll( savepos)
    243          'HighlightCursor'
    244       endif
    245       if savemark = '' then
    246          -- Don't unmark other files
    247          if FileIsMarked() then
    248             unmark
     238      -- Check parameters
     239      parse value savepos with svline svcol svcx svcy
     240      if svline = '' | svcol = '' then
     241         -- Don't try to restore pos.
     242         leave
     243      endif
     244      if svcx = '' | svcy = '' then
     245         -- Take the scroll data of the next state instead
     246         -- Check parameters
     247         if nextcx = '' | nextcy = '' then
     248            -- Don't try to restore pos.
     249            leave
     250         else
     251            -- Rebuild savepos string
     252            -- Use line and col of SelectedState
     253            savepos = svline svcol nextcx nextcy
    249254         endif
    250       else
    251          call prestore_mark( savemark)
    252       endif
    253 
    254       -- Invalidate array of multi-line comment positions, used by passist()
    255       if IsADefProc( 'prune_assist_array') then
    256          call prune_assist_array()
    257       endif
    258       'MatchFindOnMove'
     255      endif
     256
     257      --dprintf( 'SelectUndo: prestore_pos_min_scroll( 'savepos')')
     258      call prestore_pos_min_scroll( savepos)
     259      'HighlightCursor'
    259260   enddo
     261
     262   if savemark = '' then
     263      -- Don't unmark other files
     264      if FileIsMarked() then
     265         unmark
     266      endif
     267   else
     268      call prestore_mark( savemark)
     269   endif
     270
     271   -- Invalidate array of multi-line comment positions, used by passist()
     272   if IsADefProc( 'prune_assist_array') then
     273      call prune_assist_array()
     274   endif
     275   'MatchFindOnMove'
    260276
    261277   return
Note: See TracChangeset for help on using the changeset viewer.