[gforth] / gforth / history.fs  

gforth: gforth/history.fs

Diff for /gforth/history.fs between version 1.51 and 1.54

version 1.51, Sat May 5 17:26:02 2007 UTC version 1.54, Thu Jun 7 20:57:13 2007 UTC
Line 200 
Line 200 
   
 Variable curpos  Variable curpos
   
   s" os-type" environment? [IF] s" cygwin" str= [IF]
   : save-cursor ( -- ) #esc emit '7 emit ;
   : restore-cursor ( -- ) #esc emit '8 emit ;
   : cur-correct ( addr u -- )  2drop ;
   [ELSE]
 : at-xy? ( -- x y )  : at-xy? ( -- x y )
     key? drop      key? drop
     #esc emit ." [6n"  0 0      #esc emit ." [6n"  0 0
Line 212 
Line 217 
 : cursor! ( n -- )  form nip /mod at-xy ;  : cursor! ( n -- )  form nip /mod at-xy ;
 : cur-correct  ( addr u -- )  x-width curpos @ + cursor@ -  : cur-correct  ( addr u -- )  x-width curpos @ + cursor@ -
     form nip >r  r@ 2/ + r@ / r> * negate curpos +! ;      form nip >r  r@ 2/ + r@ / r> * negate curpos +! ;
   
 : save-cursor ( -- )  cursor@ curpos ! ;  : save-cursor ( -- )  cursor@ curpos ! ;
 : restore-cursor ( -- )  curpos @ cursor! ;  : restore-cursor ( -- )  curpos @ cursor! ;
   [THEN]
 : .rest ( addr pos1 -- addr pos1 )  : .rest ( addr pos1 -- addr pos1 )
       key? ?EXIT
     restore-cursor 2dup type 2dup cur-correct ;      restore-cursor 2dup type 2dup cur-correct ;
 : .all ( span addr pos1 -- span addr pos1 )  : .all ( span addr pos1 -- span addr pos1 )
       key? ?EXIT
     restore-cursor >r 2dup swap type 2dup swap cur-correct r> ;      restore-cursor >r 2dup swap type 2dup swap cur-correct r> ;
 : xback-restore ( u -- )  : xback-restore ( u -- )
     drop restore-cursor ;      drop key? ?EXIT
       restore-cursor ;
   
 \ In the following, addr max is the buffer, addr span is the current  \ In the following, addr max is the buffer, addr span is the current
 \ string in the buffer, and pos1 is the cursor position in the buffer.  \ string in the buffer, and pos1 is the cursor position in the buffer.
Line 232 
Line 240 
     2dup chars + r@ swap r@ xc-size xc!+? 2drop drop      2dup chars + r@ swap r@ xc-size xc!+? 2drop drop
     r> xc-size >r  rot r@ chars + -rot r> chars + ;      r> xc-size >r  rot r@ chars + -rot r> chars + ;
 : (xins)  ( max span addr pos1 xc -- max span addr pos2 )  : (xins)  ( max span addr pos1 xc -- max span addr pos2 )
     <xins> key? ?EXIT .all .rest ;      <xins> .all .rest ;
 : xback  ( max span addr pos1 -- max span addr pos2 f )  : xback  ( max span addr pos1 -- max span addr pos2 f )
     dup  IF  over + xchar- over -  0 max .all .rest      dup  IF  over + xchar- over -  0 max .all .rest
     ELSE  bell  THEN 0 ;      ELSE  bell  THEN 0 ;


Generate output suitable for use with a patch program
Legend:
Removed from v.1.51  
changed lines
  Added in v.1.54

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help