ulyssa / modalkit

A Rust library for building modal editing applications
Apache License 2.0
49 stars 5 forks source link

Convert EditContext trait into a struct #125

Closed ulyssa closed 5 months ago

ulyssa commented 5 months ago

I initially made EditContext a trait, so that the different keybindings for Vim, Emacs, etc., could implement it for their own context structs. I'd thought that this would make some things simpler in the Emacs keybindings since it could return constants for some of the methods, but it really just ends up complicating things for everyone who needs to consume EditContext, and makes some command bar features harder to implement.

I've converted EditContext into a struct, and turned InputContext into InputState, with an associate Output type. This ended up requiring updating a lot of places, but I think that the end result should be simpler.