sminez / ad

an adaptable text editor
https://crates.io/crates/ad-editor
MIT License
264 stars 10 forks source link

Execute a command using selected text #35

Closed sminez closed 1 month ago

sminez commented 1 month ago

Implements #31

@davcam I wont ask you for a review of what's going on here as that's a bit much given I'm the only one familiar with the internals of the project(!) but this PR branch should be buildable locally for you to try this out while I work on adding test coverage of the new mouse behaviour. (@srenatus you've seemed quite keen on seeing more acme functionality in ad so you might be interested in this as well!)

Summary of changes

Demo

https://github.com/user-attachments/assets/35d25a1b-2271-4b4d-b4bf-4f881a4e6a22

srenatus commented 1 month ago

I've watched the demo, it's very nice. I'm especially a fan of Acme's cut/paste chords.

One thing I've noticed, and that's unrelated to this PR (sorry) and probably impossible (double-sorry for bringing it up regardless): In acme, if you right-click to search something, the cursor jumps to the findings. So to keep searching, you can keep pressing right-click, right-click, right-click. It's no big deal, I think in ad you'd just keep pressing enter -- the selection moves, after all, just the mouse pointer cannot.

Another peanut gallery remark, it would be pretty useful if the screenshare would show what you pressed while recording the demo. It's more or less clear for this demo, but I'd like to learn more about other people's general usage of key bindings etc when using the editor. (Anecdotally, it took me a while to find <space> b after I saw that something like this must exist in a screencast. Similarly, figuring out that - is a thing if fd is installed (or the find-command configured differently) changed my experience a lot.)

srenatus commented 1 month ago

Also: thanks for pushing this forward. 🥳

sminez commented 1 month ago

Thanks for taking a look @srenatus! The warping of the cursor is something I'd love to get working but I'm reasonably sure it'd be a massive hack (if possible at all) in a terminal UI. So at some point I really should look at writing a full GUI.

The new ":help" command shows how some things work but I need to find time to finish the documentation and ideally generate it from the source code.

As for showing interactions in the demos, I was wondering about that and I can probably actually build that in to ad itself, echoing the inputs out in the status line. One to look at later 😅