Re: [dev] another text user interface for sam

From: Marc André Tanner <mat_AT_brain-dump.org>
Date: Tue, 1 Mar 2016 18:12:49 +0100

Hi,

I too like the concept of structural regular expressions and would like to
experiment with ways to integrate them into vis. That is the reason why
I didn't bother implementing an ex mode and instead referred to ssam(1)
in the README.

I think structural regexp will integrate nicely with multiple selections.

Basically if you omit the command of a structural regexp the editor
would switch to visual mode and add a selection for every match. If you
are already in visual mode then the existing selections would be used
as ranges for an implicit leading loop construct (x/ in sam).
That is for an existing selection x/ and y/ could be used to split it.
Similarly the conditionals g/ and v/ would be used to keep / discard
selections.

Like in sam, the underlying data structure used in vis abstracts the text
as a byte stream which is a good match for structural regexp. Also vis
already supports an undo tree which might be useful to implement command
groups/multiple changes (i.e. {} in sam). All commands of a group should
operate on the original state of the text. Hence a command group would
be handled as follows:

 1) Take a snapshot of the current text (state S)

    For every command part of the group do

    1.1) Execute the command (changes will create a new branch in the undo tree)
    1.2) Take a snapshot of the current text (new state N)
    1.3) Revert changes of the command i.e. go to state N-1 which is S.

 2) If the changes in state S to N do not conflict then create a new
    state N+1 with all changes merged, otherwise fail the command.

Unfortunately I will most likely not have time to work on this myself
for the next couple of weeks. However if someone wants to give it a try
I would be happy to answer questions related to the current vis code
base ...

-- 
 Marc André Tanner >< http://www.brain-dump.org/ >< GPG key: 10C93617
Received on Tue Mar 01 2016 - 18:12:49 CET

This archive was generated by hypermail 2.3.0 : Tue Mar 01 2016 - 18:24:11 CET