[gforth] / gforth / history.fs  

gforth: gforth/history.fs

Diff for /gforth/history.fs between version 1.57 and 1.58

version 1.57, Sun Jun 17 19:26:42 2007 UTC version 1.58, Sat Jun 30 23:00:14 2007 UTC
Line 201 
Line 201 
 [IFUNDEF] #esc  27 Constant #esc  [THEN]  [IFUNDEF] #esc  27 Constant #esc  [THEN]
   
 Variable curpos  Variable curpos
   Variable screenw
   
 : cygwin? ( -- flag ) s" TERM" getenv s" cygwin" str= ;  : cygwin? ( -- flag ) s" TERM" getenv s" cygwin" str= ;
 : at-xy? ( -- x y )  : at-xy? ( -- x y )
Line 211 
Line 212 
                 dup '0 '9 1+ within  IF  '0 - swap 10 * +  ELSE                  dup '0 '9 1+ within  IF  '0 - swap 10 * +  ELSE
                     drop  THEN  THEN                      drop  THEN  THEN
     REPEAT  drop 1- swap 1- ;      REPEAT  drop 1- swap 1- ;
 : cursor@ ( -- n )  at-xy? form nip * + ;  : cursor@ ( -- n )  at-xy? screenw @ * + ;
 : cursor! ( n -- )  form nip /mod at-xy ;  : cursor! ( n -- )  screenw @ /mod at-xy ;
 : xcur-correct  ( addr u -- )  : xcur-correct  ( addr u -- )
     cygwin? curpos @ -1 = or  IF  2drop EXIT  THEN      cygwin? curpos @ -1 = or  IF  2drop EXIT  THEN
     x-width curpos @ + cursor@ -      x-width curpos @ + cursor@ -
     form nip >r  r@ 2/ + r@ / r> * negate curpos +! ;      screenw @ >r  r@ 2/ + r@ / r> * negate curpos +! ;
 : save-cursor ( -- )  : save-cursor ( -- )
     cygwin? IF  #esc emit '7 emit  ELSE      cygwin? IF  #esc emit '7 emit  ELSE
         key? IF  -1  ELSE  cursor@  THEN  curpos !  THEN ;          key? IF  -1  ELSE  form nip screenw ! cursor@  THEN  curpos !  THEN ;
 : restore-cursor ( -- )  : restore-cursor ( -- )
     cygwin? IF  #esc emit '8 emit  ELSE      cygwin? IF  #esc emit '8 emit  ELSE
         curpos @ dup -1 = IF  drop  ELSE   cursor!  THEN  THEN ;          curpos @ dup -1 = IF  drop  ELSE   cursor!  THEN  THEN ;
Line 236 
Line 237 
     drop key? ?EXIT      drop key? ?EXIT
     restore-cursor ;      restore-cursor ;
   
   : xretype ( max span addr pos1 -- max span addr pos1 )
       restore-cursor screenw @ >r save-cursor
       .all 2 pick r@ / 1+ screenw @ r> - * 0 max spaces .rest false ;
   
 \ 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 314 
Line 319 
     ['] xclear-tib   ctrl K bindkey      ['] xclear-tib   ctrl K bindkey
     ['] xfirst-pos   ctrl A bindkey      ['] xfirst-pos   ctrl A bindkey
     ['] xend-pos     ctrl E bindkey      ['] xend-pos     ctrl E bindkey
       ['] xretype      bl     bindkey
     history IF  ['] (xenter)     #lf    bindkey  THEN      history IF  ['] (xenter)     #lf    bindkey  THEN
     history IF  ['] (xenter)     #cr    bindkey  THEN      history IF  ['] (xenter)     #cr    bindkey  THEN
     ['] xtab-expand  #tab   bindkey      ['] xtab-expand  #tab   bindkey


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

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help