Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
655B

  1. : mode! ( c -- ) 4 col- 0 AT-XY ;
  2. : contents
  3. 16 0 DO
  4. large? IF 3 ELSE 0 THEN I 3 + AT-XY
  5. 64 I * BLK( + ( lineaddr ) xoff @ + DUP width + SWAP
  6. DO I C@ 0x20 MAX EMIT LOOP LOOP
  7. large? IF 3 16 gutter THEN ;
  8. : selblk BLK> @ PREVBLK ! BLK@ contents ;
  9. : pos! ( newpos -- ) EDPOS @ PREVPOS !
  10. DUP 0< IF DROP 0 THEN 1023 MIN EDPOS ! ;
  11. : xoff? pos@ DROP ( x )
  12. xoff @ ?DUP IF < IF 0 xoff ! contents THEN ELSE
  13. width >= IF 64 COLS - xoff ! contents THEN THEN ;
  14. : setpos ( -- ) pos@ 3 + ( header ) SWAP ( y x ) xoff @ -
  15. large? IF 3 + ( gutter ) THEN SWAP AT-XY ;
  16. : cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ;