VE: allow usage on screens narrower than 67 columns
Previously, display would be completely broken. We have yet to add a way to display the "right" part of a buffer on such smaller displays.
This commit is contained in:
parent
10da104873
commit
6a7c8ae1c8
2
blk/126
2
blk/126
@ -2,6 +2,7 @@ CREATE CMD 2 C, '$' C, 0 C,
|
|||||||
CREATE PREVPOS 0 , CREATE PREVBLK 0 ,
|
CREATE PREVPOS 0 , CREATE PREVBLK 0 ,
|
||||||
: MIN ( n n - n ) 2DUP > IF SWAP THEN DROP ;
|
: MIN ( n n - n ) 2DUP > IF SWAP THEN DROP ;
|
||||||
: MAX ( n n - n ) 2DUP < IF SWAP THEN DROP ;
|
: MAX ( n n - n ) 2DUP < IF SWAP THEN DROP ;
|
||||||
|
: large? COLS 67 > ; : col- 67 COLS MIN -^ ;
|
||||||
: acc@ ACC @ 1 MAX ;
|
: acc@ ACC @ 1 MAX ;
|
||||||
: num ACC @ SWAP _pdacc IF ACC ! ELSE DROP THEN ;
|
: num ACC @ SWAP _pdacc IF ACC ! ELSE DROP THEN ;
|
||||||
: nspcs ( n -- , spit n space ) 0 DO SPC LOOP ;
|
: nspcs ( n -- , spit n space ) 0 DO SPC LOOP ;
|
||||||
@ -12,3 +13,4 @@ CREATE PREVPOS 0 , CREATE PREVBLK 0 ,
|
|||||||
SPC EDPOS @ 64 /MOD . ',' EMIT . SPC
|
SPC EDPOS @ 64 /MOD . ',' EMIT . SPC
|
||||||
BLKDTY @ IF '*' EMIT THEN 10 nspcs ;
|
BLKDTY @ IF '*' EMIT THEN 10 nspcs ;
|
||||||
: nums 17 1 DO 2 I + aty I . SPC SPC LOOP ;
|
: nums 17 1 DO 2 I + aty I . SPC SPC LOOP ;
|
||||||
|
: mode! ( c -- ) 4 col- 0 AT-XY ;
|
||||||
|
14
blk/127
14
blk/127
@ -1,16 +1,16 @@
|
|||||||
: contents 16 0 DO 3 I 3 + AT-XY
|
: contents 16 0 DO large? IF 3 ELSE 0 THEN I 3 + AT-XY
|
||||||
64 I * BLK( + DUP 64 + SWAP DO
|
64 I * BLK( + DUP 3 col- + SWAP DO
|
||||||
I C@ 0x20 MAX EMIT LOOP LOOP
|
I C@ 0x20 MAX EMIT LOOP LOOP
|
||||||
3 16 gutter ;
|
large? IF 3 16 gutter THEN ;
|
||||||
: selblk BLK> @ PREVBLK ! BLK@ contents ;
|
: selblk BLK> @ PREVBLK ! BLK@ contents ;
|
||||||
: mode! ( c -- ) 63 0 AT-XY ;
|
|
||||||
: pos! ( newpos -- ) EDPOS @ PREVPOS !
|
: pos! ( newpos -- ) EDPOS @ PREVPOS !
|
||||||
DUP 0< IF DROP 0 THEN 1023 MIN EDPOS ! ;
|
DUP 0< IF DROP 0 THEN 1023 MIN EDPOS ! ;
|
||||||
: setpos ( -- ) EDPOS @ 64 /MOD
|
: setpos ( -- ) EDPOS @ 64 /MOD
|
||||||
3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ;
|
3 + ( header ) SWAP large? IF 3 + ( gutter ) THEN
|
||||||
|
SWAP AT-XY ;
|
||||||
: cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ;
|
: cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ;
|
||||||
: buftype ( buf ln -- )
|
: buftype ( buf ln -- )
|
||||||
3 OVER AT-XY KEY DUP EMIT
|
3 OVER AT-XY KEY DUP EMIT
|
||||||
DUP 0x20 < IF 2DROP DROP EXIT THEN
|
DUP 0x20 < IF 2DROP DROP EXIT THEN
|
||||||
( buf ln c ) 63 nspcs SWAP 4 SWAP AT-XY ( buf c ) SWAP C!+
|
( buf ln c ) 4 col- nspcs SWAP 4 SWAP AT-XY ( buf c )
|
||||||
IN( _zbuf (rdln) IN( SWAP 63 MOVE ;
|
SWAP C!+ IN( _zbuf (rdln) IN( SWAP 63 MOVE ;
|
||||||
|
5
blk/131
5
blk/131
@ -4,10 +4,11 @@
|
|||||||
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
|
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
|
||||||
0 ACC ! UPPER 'Q' = ;
|
0 ACC ! UPPER 'Q' = ;
|
||||||
: bufp ( buf -- )
|
: bufp ( buf -- )
|
||||||
DUP 64 + SWAP DO I C@ 0x20 MAX EMIT LOOP ;
|
DUP 3 col- + SWAP DO I C@ 0x20 MAX EMIT LOOP ;
|
||||||
: bufs
|
: bufs
|
||||||
1 aty ." I: " IBUF bufp
|
1 aty ." I: " IBUF bufp
|
||||||
2 aty ." F: " FBUF bufp 0 3 gutter ;
|
2 aty ." F: " FBUF bufp
|
||||||
|
large? IF 0 3 gutter THEN ;
|
||||||
: VE
|
: VE
|
||||||
clrscr 0 ACC ! 0 PREVPOS ! nums contents
|
clrscr 0 ACC ! 0 PREVPOS ! nums contents
|
||||||
BEGIN status bufs setpos KEY handle UNTIL
|
BEGIN status bufs setpos KEY handle UNTIL
|
||||||
|
Loading…
Reference in New Issue
Block a user