From 0050d20370165334536498aa23b0b79bb41f2e6e Mon Sep 17 00:00:00 2001 From: d6 Date: Sat, 9 Apr 2022 00:16:22 -0400 Subject: [PATCH] update docs --- femto.tal | 14 +++++--------- femto.txt | 31 ++++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/femto.tal b/femto.tal index f995dc6..b2096a4 100644 --- a/femto.tal +++ b/femto.tal @@ -177,11 +177,7 @@ ( using error! will print the given message before causing ) ( the interpreter to halt. ) @error! ( msg* -> ) - emit-! sp - ;print JSR2 -( &loop LDAk #00 EQU ,&done JCN - LDAk emit INC2 ,&loop JMP - &done POP2 ) nl dbg BRK + emit-! sp ;print JSR2 nl dbg BRK ( open the given file at editor start up ) ( ) @@ -713,8 +709,6 @@ ;redraw-prompt-and-cursor JSR2 ;return JMP2 -( TODO: need to add \r back in for windows ) - ( save the file with the filename found in tmp/data ) @do-save ( -> ) .buffer/limit LDZ2 ;data SUB2 STH2 ( [size] ) @@ -1566,6 +1560,7 @@ &term-size-parse-error "Error 20 "parsing 20 "term 20 "size 00 ] +( perform the undo action ) @undo ( -> ) #01 .state/in-undo STZ ;undo-stack/pos LDA2 ;undo-stack/data EQU2 ,&noop JCN @@ -1583,6 +1578,7 @@ &delete POP ;delete JMP2 &noop BRK +( free up space in the undo stack by evicting the oldest entry ) @u-free ( -> ) ;undo-stack/data STH2k #0003 ADD2 ( st+3 [st] ) &loop LDAk STH2kr STA @@ -1591,6 +1587,7 @@ &done ;undo-stack/pos LDA2k #0003 SUB2 SWP2 STA2 POP2 POP2r JMP2r +( push a new item on the undo stack ) @u-push ( c^ addr* -> ) ;undo-stack/pos DUP2 LDA2 ( c^ addr* top* pos* ) GTH2 ( c^ addr* top>pos^ ) ,&has-room JCN ( c^ addr* ) @@ -1613,8 +1610,7 @@ ( - 1 byte: character to insert, or \0 to delete ) ( ) ( pos points to the next open stack frame. ) -( ) -( when pos points to data the stack is empty, and ) +( when pos points to data the stack is empty. ) ( when pos points to pos the stack is full. ) @undo-stack [ &data $180 ( 128 steps ) diff --git a/femto.txt b/femto.txt index 3b713fc..a505796 100644 --- a/femto.txt +++ b/femto.txt @@ -6,7 +6,7 @@ draws graphics using ANSI control sequences. this means the terminal must be in raw mode with echo turned off. the `femto` wrapper script achieves this -using `sttry raw -echo` (it also restores the previous +using `stty raw -echo` (it also restores the previous terminal settings on exit). ---- WARNING ---- @@ -18,15 +18,14 @@ it has bugs! please consider making backups (or using version control) before femto this to modify important files. -(i'm in the midst of adding regex search so the code -is particularly untidy right now. sorry!) - ---- getting started ---- you must provide a path to a file when starting femto: ./femto femto.tal +(if the file does not exist, femto will create it on save.) + the femto launcher script makes many assumptions: - uxnasm and uxncli are both in the PATH @@ -39,10 +38,9 @@ packaging process can be explored. ---- current status ---- - - can't create new files that don't already exist - can't create new directories while saving - doesn't support horizontal scrolling for long lines - - no search (or search&replace) + - no search & replace - no copy/paste - few help messages - doesn't support function keys, mouse, etc. @@ -56,6 +54,7 @@ the femto status line contains a lot of information: 3. the number of bytes/lines (e.g. "[49 bytes, 8 lines]" 4. the x/y cursor position (e.g. "(1,8)" for col 1, row 8) 5. whether tabs ("[t]") or spaces ("[s]") are inserted by tab key + 6. how many items are in the undo stack (e.g. "u:13") ---- special key bindings ---- @@ -65,6 +64,8 @@ the femto status line contains a lot of information: C-b move back one character (or LEFT ARROW) C-f move forward one character (or RIGHT ARROW) + M-b move back by one word + M-f move forward by one word C-n move down one line (or DOWN ARROW) C-p move up one line (or UP ARROW) M-v page up (or PAGE DOWN) @@ -77,10 +78,26 @@ the femto status line contains a lot of information: M-g go to line C-l center screen on cursor line + C-s search for a substring [1] + M-s search for matches using a regular expression [1] + C-d delete M-c toggle color scheme M-t toggle tabs-vs-spaces indentation - C-l refresh screen (DEBUG) (C stands for Control) (M stands for Meta, often Alt or Option) + +---- search [1] ---- + +when searching femto will highlight matches and accepts +the following commands: + + - C-g: cancel the search and restore the cursor + - Enter: end the search, leaving the cursor where it is + - n (or C-s): move forward to the next match, if any + - p (or C-r): move backwards to the previous match, if any + +basic regular expression syntax is mostly working, although there +are notable absences such as character classes (e.g. [] and [^]), +references to capture groups (e.g. \1), and repetitions (e.g. {n}).