bazed-editor / bazed

The baz editor
Apache License 2.0
26 stars 3 forks source link

Implement selections #51

Closed elkowar closed 1 year ago

elkowar commented 1 year ago

This PR provides a basic implementation of selections.

Firstly, we move back to representing the previous Marks as Regions, as that makes it significantly easier to reason about selections being active or not. An alternative approach I kinda like would be to have Mark be one of

enum MarkKind {
  Region(usize, usize),
  Cursor(usize),
}

and distinguish based on that, rather than purely based on the length -- but that might just be unnecessary complexity.

I then add a new Operation Selection, in the process factor out MovementOp into a more general Motion enum, moving on to combining MovementOp and EditOp into a unified BufferOp.

This PR is based on #48, which should be merged first