Changeset 3224


Ignore:
Timestamp:
Oct 27, 2018, 9:28:35 PM (6 years ago)
Author:
Andreas Schnellbacher
Message:
  • Added parameter checking for prestore_pos and prestore_pos_min_scroll.
  • Cosmetic changes.
File:
1 edited

Legend:

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

    r3212 r3224  
    770770   endif
    771771
     772; ---------------------------------------------------------------------------
    772773; PMARK_WORD: mark the word pointed at by the cursor.  If the cursor is on a
    773774; space, the word at the right is marked.  If there is no word on the right, the
     
    795796  'Copy2SharBuff'  -- Copy mark to shared text buffer
    796797
     798; ---------------------------------------------------------------------------
    797799defproc pset_mark( firstline, lastline, firstcol, lastcol, mt, fileid)
    798800   mtnum = wordpos( mt, 'LINE CHAR BLOCK CHARG BLOCKG') - 1
    799801   setmark firstline, lastline, firstcol, lastcol, mtnum, fileid
    800802
     803; ---------------------------------------------------------------------------
    801804; PSAVE_MARK: save the current marks (cannot be used as a stack) See also
    802805; prestore_pos()
     
    811814   endif
    812815
     816; ---------------------------------------------------------------------------
    813817; PRESTORE_MARK: restore the current marks (cannot be used as a stack) See also
    814818; psave_mark
    815819defproc prestore_mark( savemark)
    816    unmark
    817    parse value savemark with savefirstline savelastline savefirstcol savelastcol savemkfileid savemt
    818    if savemt <> '' then
     820   do once = 1 to 1
     821      parse value savemark with savefirstline savelastline savefirstcol savelastcol savemkfileid savemt
     822
     823      -- Check parameters
     824      if savemt = '' then
     825         leave
     826      endif
     827
     828      unmark
    819829      call pset_mark( savefirstline, savelastline, savefirstcol, savelastcol, savemt, savemkfileid)
    820    endif
     830   enddo
    821831
    822832; ---------------------------------------------------------------------------
     
    848858   -- cursor would be off the visible area.
    849859
     860; ---------------------------------------------------------------------------
    850861; PRESTORE_POS: restore the cursor position (cannot be used as a stack) See
    851862; also psave_pos()
     
    854865   universal lastscrollx
    855866
    856    parse value save_pos with svline svcol svcx svcy
    857    if svcol = 1600 then                     -- handle wrong EA EPM.POS
    858       svcol = 1
    859    endif
    860    .cursory = svcy                          -- set .cursory
    861    min( svline, .last)                      -- set .line
    862    .col = MAXCOL; .col = svcol - svcx + 1   -- set left edge of window
    863    .col = svcol                             -- set .col
    864 
    865    -- Workaround for avoiding additional .scrollx offset
    866    -- (see also defload):
    867    -- Restore .scrollx, if not processed during file loading
    868    if loadstate = 0 then
    869       if lastscrollx <> '' then
    870          .scrollx = lastscrollx   -- set hidden pixels at the left
    871       endif
    872       -- .scrolly is always 0
    873    endif
    874 
     867   do once = 1 to 1
     868      parse value save_pos with svline svcol svcx svcy
     869
     870      -- Check parameters
     871      if svcy = '' then
     872         leave
     873      endif
     874
     875      if svcol = 1600 then                     -- handle wrong EA EPM.POS
     876         svcol = 1
     877      endif
     878      .cursory = svcy                          -- set .cursory
     879      min( svline, .last)                      -- set .line
     880      .col = MAXCOL; .col = svcol - svcx + 1   -- set left edge of window
     881      .col = svcol                             -- set .col
     882
     883      -- Workaround for avoiding additional .scrollx offset
     884      -- (see also defload):
     885      -- Restore .scrollx, if not processed during file loading
     886      if loadstate = 0 then
     887         if lastscrollx <> '' then
     888            .scrollx = lastscrollx   -- set hidden pixels at the left
     889         endif
     890         -- .scrolly is always 0
     891      endif
     892   enddo
     893
     894; ---------------------------------------------------------------------------
    875895; Like prestore_pos, but minimize scrolling
    876896defproc prestore_pos_min_scroll( save_pos)
     
    878898   universal lastscrollx
    879899
    880    parse value save_pos with svline svcol svcx svcy
    881    if svcol = 1600 then                        -- handle wrong EA EPM.POS
    882       svcol = 1
    883    endif
    884    if OnScreen( svline, svcol) then
    885       .lineg = min( svline, .last)             -- set .line without scrolling
    886       .col = svcol                             -- set .col
    887    else
    888       .cursory = svcy                          -- set .cursory
    889       min( svline, .last)                      -- set .line
    890       .col = MAXCOL; .col = svcol - svcx + 1   -- set left edge of window
    891       .col = svcol                             -- set .col
    892    endif
    893 
    894    -- Workaround for avoiding additional .scrollx offset
    895    -- (see also defload):
    896    -- Restore .scrollx, if not processed during file loading
    897    if loadstate = 0 then
    898       if lastscrollx <> '' then
    899          .scrollx = lastscrollx   -- set hidden pixels at the left
    900       endif
    901       -- .scrolly is always 0
    902    endif
     900   do once = 1 to 1
     901      parse value save_pos with svline svcol svcx svcy
     902
     903      -- Check parameters
     904      if svcy = '' then
     905         leave
     906      endif
     907
     908      if svcol = 1600 then                        -- handle wrong EA EPM.POS
     909         svcol = 1
     910      endif
     911      if OnScreen( svline, svcol) then
     912         .lineg = min( svline, .last)             -- set .line without scrolling
     913         .col = svcol                             -- set .col
     914      else
     915         .cursory = svcy                          -- set .cursory
     916         min( svline, .last)                      -- set .line
     917         .col = MAXCOL; .col = svcol - svcx + 1   -- set left edge of window
     918         .col = svcol                             -- set .col
     919      endif
     920
     921      -- Workaround for avoiding additional .scrollx offset
     922      -- (see also defload):
     923      -- Restore .scrollx, if not processed during file loading
     924      if loadstate = 0 then
     925         if lastscrollx <> '' then
     926            .scrollx = lastscrollx   -- set hidden pixels at the left
     927         endif
     928         -- .scrolly is always 0
     929      endif
     930   enddo
    903931
    904932; ---------------------------------------------------------------------------
     
    925953   endif
    926954
     955; ---------------------------------------------------------------------------
    927956; ProcessEndScroll is called when the scroll bar slider is released with
    928957; the pointer.
Note: See TracChangeset for help on using the changeset viewer.