Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 1.69 KB

README.md

File metadata and controls

77 lines (55 loc) · 1.69 KB

e - a text editor

e will be a text editor written in C. It'll follow a transparent client-server to allow concurrent editing of the same file(s). tree-sitter will be used for syntax highlighting and basic code analysis.

e isn't ready for use (or even testing) yet.

ToDo

  • rope data structure
  • range/cursor handling
  • command framework (do/undo)
  • socket protocol (json/bjson?)
  • daemon lifecycle
  • tree-sitter integration
  • command line frontend
  • vt100 frontend

Concepts

  • e-editor
    • 0-n documents representing opened files
      • 0-n documents editors
        • undo/redo stack
        • 0-n cursors
          • cursor position
          • edit actions

protocol

newline delimited json protocol with optional trailing payload or inline payload

Inline Payload

{ "action": "insert", "payload": "Hello World!" }

Trailing Payload

A trailing payload is indicated by the payload field being a number.

{ "action": "insert", "payload": 12 }
Hello World!

Alternative command mode

For convenience there is an alternative syntax for commands, that is easier to type in a terminal. This mode is never sent by e but can be used to make interaction with the daemon easier.

command arg1 arg2 arg3

The above is equivalent to:

{ "action": "command", "payload": ["arg1", "arg2", "arg3"], "payload_str": "arg1 arg2 arg3" }

you can also embed json in the payload:

command arg1 arg2 {"foo": "bar"}

is equivalent to:

{ "action": "command", "payload": ["arg1", "arg2", {"foo": "bar"}], "payload_str": "arg1 arg2 {\"foo\": \"bar\"}" }