1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-02 04:10:56 +11:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Virgil Dupras
4af93d53e3 VE: add I command
Also, add insert and find buffers to the header, making it 3 lines
high.

Also, fix the "I" overshadowing word which wasn't operating on the
proper RSP level.

Also, fix I which didn't mark the block as dirty.
2020-06-04 22:54:27 -04:00
Virgil Dupras
e36080d7b8 VE: load Block Editor and reuse some of its words 2020-06-04 20:20:35 -04:00
Virgil Dupras
297c187426 VE: add mode indicator in status bar 2020-06-04 20:07:02 -04:00
Virgil Dupras
2bf4db59ed VE: Add H and L
Also, add MODE indirection.
2020-06-04 19:20:40 -04:00
Virgil Dupras
878df2d53b VE: make w affected by modifier 2020-06-04 18:59:54 -04:00
Virgil Dupras
98e820cf51 WE: why case-insensitive again? 2020-06-04 18:52:59 -04:00
Virgil Dupras
11843cc613 VE: add W and S movements 2020-06-04 17:22:07 -04:00
11 changed files with 55 additions and 29 deletions

View File

@ -5,7 +5,7 @@ F xxx: find typed string in block.
I xxx: insert typed string at cursor. I xxx: insert typed string at cursor.
E: Delete previously found string. E: Delete previously found string.
Note that "I" shadows core word. Use "i" to access core word.

View File

@ -1,5 +1,5 @@
'? CASE NOT [IF] 51 52 LOADR+ [THEN] DROP ( B152-153 ) '? CASE NOT [IF] 51 52 LOADR+ [THEN] DROP ( B152-153 )
'? FILL NOT [IF] 53 LOAD+ [THEN] DROP ( B154 ) '? FILL NOT [IF] 53 LOAD+ [THEN] DROP ( B155 )
1 7 LOADR+ 1 7 LOADR+
: BROWSE : BROWSE
0 ACC ! L 0 ACC ! L
@ -12,5 +12,3 @@
ENDCASE ENDCASE
AGAIN AGAIN
; ;
( I masks DO..LOOP's I. Do it as late as possible. )
: I _I ;

View File

@ -2,7 +2,8 @@
DUP BEGIN C@+ EOL? UNTIL -^ 1- ; DUP BEGIN C@+ EOL? UNTIL -^ 1- ;
: _rbufsz ( size of linebuf to the right of curpos ) : _rbufsz ( size of linebuf to the right of curpos )
EDPOS @ 64 MOD 63 -^ ; EDPOS @ 64 MOD 63 -^ ;
: _I : i COMPILE I ; IMMEDIATE ( save overshadowed )
: I
IBUF _type _rbufsz IBUF _blen 2DUP > IF IBUF _type _rbufsz IBUF _blen 2DUP > IF
TUCK - ( ilen chars-to-move ) TUCK - ( ilen chars-to-move )
SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen ) SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen )
@ -11,5 +12,5 @@
ELSE DROP ( ilen becomes rbuffsize ) ELSE DROP ( ilen becomes rbuffsize )
THEN THEN
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen ) DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen )
EDPOS +! EDPOS @ 64 / _pln BLK!! EDPOS +! EDPOS @ 64 / _pln
; ;

View File

@ -4,7 +4,8 @@ This editor, unlike the Block Editor (B100), is grid-based
instead of being command-based. It requires the AT-XY, COLS instead of being command-based. It requires the AT-XY, COLS
and LINES words to be implemented. and LINES words to be implemented.
It is loaded with "125 LOAD" and invoked with "VE". It is loaded with "125 LOAD" and invoked with "VE". Note that
this also fully loads the Block Editor (B100).
This editor uses 17 lines. The top line is the status line and This editor uses 17 lines. The top line is the status line and
the 16 others are contents lines. The content shown is that the 16 others are contents lines. The content shown is that
@ -12,5 +13,4 @@ of the currently selected block.
All keystrokes are directly interpreted by VE and have the All keystrokes are directly interpreted by VE and have the
effect described below. effect described below.
(cont.) (cont.)

View File

@ -4,13 +4,13 @@ keystokes described below. The modifier starts at zero, but
most commands interpret a zero as a 1 so that they can have an most commands interpret a zero as a 1 so that they can have an
effect. effect.
'G' selects the block specified by the modifier as the current 'g' selects the block specified by the modifier as the current
block. Any change madde to the previously selected block is block. Any change madde to the previously selected block is
saved beforehand. saved beforehand.
'[' and ']' advance the selected block by modifier. '[' and ']' advance the selected block by modifier.
';' resets the modifier ';' resets the modifier. 'q' quits.
H and L move the cursor by "modifier" characters. J and K, by 'h' and 'l' move the cursor by "modifier" characters. 'j' and
lines. 'k', by lines. (cont.)

6
blk/122 Normal file
View File

@ -0,0 +1,6 @@
'H' goes to the beginning of the line, 'L' to the end.
'w' moves forward by a word. 'W' moves backward by a word.
'I' inserts text by calling the "I" command from the Block
editor.

View File

@ -1,2 +1,3 @@
'? UPPER NOT [IF] 33 LOAD+ [THEN] DROP ( B158 ) '? UPPER NOT [IF] 33 LOAD+ [THEN] DROP ( B158 )
1 2 LOADR+ -23 LOAD+ ( B102, block editor )
1 4 LOADR+

View File

@ -1,14 +1,13 @@
CREATE CMD 2 C, '$' C, 0 C, CREATE CMD 2 C, '$' C, 0 C,
VARIABLE ACC VARIABLE MODE VARIABLE MODEC
VARIABLE POS
: 0acc 0 ACC ! ; : 0acc 0 ACC ! ;
: acc@ ACC @ 1 MAX 0acc ; : acc@ ACC @ 1 MAX 0acc ;
: num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ; : num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ;
: nspcs ( n -- , spit n space ) 0 DO SPC LOOP ; : nspcs ( n -- , spit n space ) 0 DO SPC LOOP ;
: aty 0 SWAP AT-XY ; : aty 0 SWAP AT-XY ;
: clrln DUP aty COLS nspcs aty ; : clrln DUP aty COLS nspcs aty ;
: clrscr LINES 0 DO I clrln LOOP ; : clrscr LINES 0 DO i clrln LOOP ;
: status 0 clrln ." BLK" SPC BLK> ? SPC ACC ? : status 0 clrln ." BLK" SPC BLK> ? SPC ACC ?
SPC POS @ 64 /MOD . ',' EMIT . ; SPC EDPOS @ 64 /MOD . ',' EMIT . SPC MODEC C@ EMIT ;
: contents 1 aty BLK> @ LIST ; : contents 3 aty BLK> @ LIST ;
: selblk BLK@ contents ; : selblk BLK@ contents ;

19
blk/127
View File

@ -1,15 +1,12 @@
: setpos POS @ 64 /MOD 1+ ( status line ) AT-XY ; : setpos EDPOS @ 64 /MOD
: pos+ POS @ + 1024 MOD POS ! ; 3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ;
: pos+ EDPOS @ + 1024 MOD EDPOS ! ;
: cmv ( n -- , char movement ) acc@ * pos+ ; : cmv ( n -- , char movement ) acc@ * pos+ ;
: $; 0acc ; : $; 0acc ;
: $G ACC @ selblk 0acc ; : $g ACC @ selblk 0acc ;
: $[ BLK> @ acc@ - selblk ; : $[ BLK> @ acc@ - selblk ;
: $] BLK> @ acc@ + selblk ; : $] BLK> @ acc@ + selblk ;
: $H -1 cmv ; : $L 1 cmv ; : $K -64 cmv ; : $J 64 cmv ; : $I 3 1 AT-XY I contents ;
: handle ( c -- f ) : $h -1 cmv ; : $l 1 cmv ; : $k -64 cmv ; : $j 64 cmv ;
UPPER DUP '0' '9' =><= IF num 0 EXIT THEN : $H 0acc EDPOS @ 0x3c0 AND EDPOS ! ;
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN : $L 0acc EDPOS @ 0x3f OR EDPOS ! ;
'Q' = ;
: VE clrscr 0acc 0 POS ! contents
BEGIN status setpos KEY handle UNTIL 18 aty ;

11
blk/128 Normal file
View File

@ -0,0 +1,11 @@
: $w EDPOS @ BLK( + acc@ 0 DO
BEGIN C@+ WS? UNTIL BEGIN C@+ WS? NOT UNTIL LOOP
1- BLK( - 1023 MIN EDPOS ! ;
: $W EDPOS @ BLK( + acc@ 0 DO
BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL LOOP
1+ BLK( - DUP 0< IF DROP 0 THEN EDPOS ! ;
: handleM ( c -- f )
DUP '0' '9' =><= IF num 0 EXIT THEN
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
UPPER 'Q' = ;
: modeM ['] handleM MODE ! 'M' MODEC C! ;

13
blk/129 Normal file
View File

@ -0,0 +1,13 @@
: bufp ( buf -- )
DUP 64 + SWAP DO
i C@ DUP 0x20 < IF DROP 0x20 THEN EMIT
LOOP ;
: bufs
1 aty ." I: " IBUF bufp
2 aty ." F: " FBUF bufp ;
: c<over KEY DUP EMIT DUP 0x0a = IF DROP 0x0d THEN ;
: VE ['] c<over 0x08 ( C< override ) RAM+ !
clrscr 0acc 0 EDPOS ! modeM contents
BEGIN status bufs setpos KEY MODE @ EXECUTE UNTIL
0 0x08 RAM+ ! 19 aty ;