From 64ce8ab3e960c7c4025440f33bf2f7778a5a280f Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 9 Jun 2020 21:14:16 -0400 Subject: [PATCH] ed: Improve F with repeated searches Make F search from curpos+1 so that it's possible to search the same word we've just found a second time. Previously, it would find the word under the cursor. Also, improve docs a bit. --- blk/101 | 29 ++++++++++++++--------------- blk/107 | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/blk/101 b/blk/101 index 7d0d913..98592bf 100644 --- a/blk/101 +++ b/blk/101 @@ -1,16 +1,15 @@ +There are two buffers, IBUF (insert buffer) and FBUF (find +buffer). They are used as a typing target for the actions +described below. They both have a peculiar logic: when typing +is expected to fill a buffer, an empty value means "reuse +previous value". For example, typing "I foo I " inserts +"foofoo". + T ( n -- ): select line n for editing. -P xxx: put typed line on selected line. -U xxx: insert typed line on selected line. -F xxx: find typed string in block. -I xxx: insert typed string at cursor. -E: Delete previously found string. - -Note that "I" shadows core word. Use "i" to access core word. - - - - - - - - +P xxx: put typed IBUF on selected line. +U xxx: insert typed IBUF on selected line. +F xxx: find typed FBUF in block, starting from current + position+1. If not found, don't move. +I xxx: insert typed IBUF at cursor. "I" shadows core word. Use + "i" to access it. +E: From cursor, delete X characters, X = length of FBUF. diff --git a/blk/107 b/blk/107 index c05a925..cb7aade 100644 --- a/blk/107 +++ b/blk/107 @@ -1,5 +1,5 @@ : _F ( F without _type and _pln. used in VE ) - FBUF EDPOS @ _cpos ( a1 a2 ) + FBUF EDPOS @ _cpos 1+ ( a1 a2 ) BEGIN C@+ ROT ( a2+1 c2 a1 ) C@+ ROT ( a2+1 a1+1 c1 c2 ) = NOT IF DROP FBUF THEN ( a2 a1 )