Hi,
I have added a little feature which I was missing in bigforth - search
backward in history given the string prefix. The patch is attached. It
could have been better, but for the start it works. When next time I
will get a minute that plan is to add backward pattern search.
Now if you start typing a string and then press the up arrow or ctrl p,
bigforth will backward search for the first string in history that has
the same prefix. Together with bigforth's ability to go forward in
history after you have found a needed line this should make command line
work easier, at least for me.
Placing it here in the hope that someone else finds it useful, someone
checks and corrects bugs if any and maybe Berd will add it to the main
branch.
Thanks!
--
Sergey
Index: vt100key.fs
===================================================================
--- vt100key.fs (revision 641)
+++ vt100key.fs (working copy)
@@ -203,8 +203,28 @@
rot drop
REPEAT 2drop THEN tuck ;
+: restore-hist-pos
+ history file-size throw
+ 2dup forward^ 2! backward^ 2! ;
+
: prev-line ( max span addr pos1 -- max span addr pos2 false )
- clear-line find-prev-line 2dup type 0 ;
+ 2dup pad place
+ clear-line 0 tuck
+ begin
+ drop nip
+ find-prev-line
+ backward^ 2@ 0. d= if
+ restore-hist-pos
+ drop nip dup
+ pad count dup >r rot swap cmove
+ r> tuck
+ 2dup type
+ 0 exit
+ then
+ 2dup pad count string-prefix?
+ until
+ 2dup type drop
+ pad c@ dup row at-xy 0 ;
Create lfpad #lf c,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]