From cfdc0371db7bd40376c6720122ee901d89262cd3 Mon Sep 17 00:00:00 2001 From: d6 Date: Thu, 7 Apr 2022 00:16:25 -0400 Subject: [PATCH] small clean up --- femto.tal | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/femto.tal b/femto.tal index 41663c7..4cf8169 100644 --- a/femto.tal +++ b/femto.tal @@ -92,12 +92,16 @@ |0000 ( terminal size information ) +( ) +( for now these are constant but eventually we could detect terminal resizes ) @term [ &cols $2 ( relative x coordinate of cursor, from 0 ) &rows $2 ( relative y coordinate of cursor, from 1 ) ] ( configuration settings used when editing ) +( ) +( these can be changed at any time without breaking anything else ) @config [ &tab-width $2 ( how many spaces to display tab chars ) &insert-tabs $1 ( tab key inserts tabs when true ) @@ -105,14 +109,19 @@ ] ( tracks information related to the buffer's view of data ) +( ) +( limit and line-count change when we modify the buffer. ) +( offset and line-offset change when we move the view port. ) @buffer [ &limit $2 ( last byte of actual data (not including \0) + 1 ) - &offset $2 ( first byte of data visible in terminal ) &line-count $2 ( total number of lines in file ) + &offset $2 ( first byte of data visible in terminal ) &line-offset $2 ( first line of text visible in terminal ) ] ( relative cursor positions, e.g. 0 to cols-1 ) +( ) +( when these change we may need to move the view port as well ) @cursor [ &col $2 ( current column value 0-n (may exceed lenght of row) ) &row $2 ( current relative row value, 0-(height-1) ) @@ -160,32 +169,22 @@ ( startup ) |0100 - ;init-zero-page JSR2 - ;startup JMP2 - -( import uxn regex library ) -~regex.tal - -( intialize zero page variables ) -( ) -( everything not specified starts as zero ) -@init-zero-page ( -> ) + ( init zero page ) #0050 .term/cols STZ2 #0018 .term/rows STZ2 - #0004 .config/tab-width STZ2 #00 .config/insert-tabs STZ #3333 .config/color STZ2 - ;data .buffer/offset STZ2 - JMP2r -( code to run on startup ) -@startup + ( start reading the filename from argv ) ;filename .tmp/pos STZ2 ;read-filename .Console/vector DEO2 BRK +( import uxn regex library ) +~regex.tal + ( ERROR HANDLING ) ( using error! will print the given message before causing )