Ignore:
Timestamp:
Mar 4, 2018, 7:24:01 PM (7 years ago)
Author:
Andreas Schnellbacher
Message:
  • Wrap: Added processing of marked lines, if file is marked.
  • Fixed wrap message after processing.
File:
1 edited

Legend:

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

    r2869 r2955  
    629629
    630630; ---------------------------------------------------------------------------
    631 ; Hard wrap: split lines. Try to split at words first.
     631; Hard wrap: split lines. Try to split at words first. Processes only marked
     632; lines, if current file is marked.
    632633;
    633634; Syntax: Wrap SplitCol [Style]
     
    691692   mouse_setpointer WAIT_POINTER
    692693   display -1  -- disable update of text area
    693    call psave_pos(saved_pos)
     694   call psave_pos( saved_pos)
     695
     696   fProcessMark = FileIsMarked()
     697   if fProcessMark then
     698      getmark firstl, lastl, firstc, lastc, markfid
     699      MarkToLineMark()
     700   else
     701      firstl = 1
     702      lastl = .last
     703   endif
    694704
    695705   .line = 1
    696706   .col  = 1
    697707   m = 0
    698    l = 1
    699    getfileid fid
    700    client = gethwndc(EPMINFO_EDITCLIENT)
    701    do while l <= .last
    702       -- process all lines
     708   l = firstl
     709   do forever  -- do forever is faster then using a condition
     710      -- Check if line counter is > last (marked) line
     711      if l > lastl then
     712         leave
     713      endif
     714      if l > .last then
     715         leave
     716      endif
     717
     718      -- process lines
    703719      getline line, l
    704720
     
    739755         endif
    740756
     757         lastl = lastl + 1
     758
     759         if fProcessMark then
     760            if l = lastl - 1 then
     761               -- Extend mark to include wrapped line
     762               setmark firstl, lastl, firstc, lastc, 0, markfid
     763            endif
     764         endif
     765
    741766         m = m + 1
    742767      endif  -- length( strip( line, 'T')) > SplitCol
     768
    743769      l = l + 1
    744    enddo  -- while l <= .last
    745 
    746    call prestore_pos(saved_pos)
     770   enddo  -- forever
     771
     772   call prestore_pos( saved_pos)
    747773   display 1
    748774   mouse_setpointer vEPM_POINTER
    749775
    750    Msg = 'Wrap after 'SplitCol' chars: 'm
     776   Msg = 'Wrap at column 'SplitCol': 'm
    751777   if m = 1 then
    752778      Msg = Msg' change.'
Note: See TracChangeset for help on using the changeset viewer.