Sam (Plan 9 text editor)
Created on 2024-02-18T17:32:32-06:00
uses a separate process for the interface and another to perform editing tasks; controlled over a pipe
supports different displays by changing which display process is used
Refers to the current selection as "dot," references changing or inserting text "in dot."
"addresses" as a way to represent where edits should take place; these can be at absolute positions, or the result of searches.
addresses can be combined. this permits queries such as "first find a match for foo, then find the next match of bar which follows."
changes are performed by building up commands to execute against a transaction log; this is so all searches apply to the original version of text, and updates currently in progress do not alter the way matching will be handled.
transaction log similar to a piece table. it says to go to an offset and delete or insert some amount of text. offsets must also be tracked since insertion of text at some position can push text later in the file and the log has to cope with that.
Useful things to steal
- Structural regex; build up positions by chaining together motion and search commands.
- Transaction log for inserts; batch up changes in a prepare phase, then commit everything in a separate commit phase.