faqts : Computers : Programming : Languages : Tse : Block

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

TSE: Block: Wrap: How to wrap a block to 1 line, with separator between the lines?

Nov 12th, 2006 09:31
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 12 November 2020 - 04:38 pm -------------------
TSE: Block: Wrap: How to wrap a block to 1 line, with separator 
between the lines?
Method: Replace end of lines in the block by the separators (put at the
        begin of each line), store the current right margin, set the
        right margin to another (maximum line length) value, wrap the
        block, restore the right margin
===
--- cut here: begin --------------------------------------------------
FORWARD PROC Main()
FORWARD PROC PROCBlockChange_SeparatorWrapToLine1Simple( STRING s1 )
// --- MAIN --- //
PROC Main()
 PROCBlockChange_SeparatorWrapToLine1Simple( "\#\#\#" )
END
<F12> Main()
// --- LIBRARY --- //
// library: block: change: separator: wrap: to: line1 
(filenamemacro=chanbltm.s) [kn, ri, su, 12-11-2020 04:46:24]
PROC PROCBlockChange_SeparatorWrapToLine1Simple( STRING s )
 INTEGER rightMarginOldI = Query( RightMargin )
 INTEGER rightMarginNewI = MAXLINELEN
 IF NOT IsBlockInCurrFile()
  Warn( "please mark a block" )
 ENDIF
 PushPosition()
 LReplace( "^", s, "glnx")
 Set( RightMargin, rightMarginNewI )
 GotoBlockBegin()
 ExecMacro( "wrappara" )
 Set( RightMargin, rightMarginOldI )
 PopPosition()
END
--- cut here: end ----------------------------------------------------
===
Internet: see also:
---
----------------------------------------------------------------------