pulsar-edit / pulsar

A Community-led Hyper-Hackable Text Editor
https://pulsar-edit.dev
Other
3.33k stars 140 forks source link

Remove ambiguity in all text movement method names… #1042

Open savetheclocktower opened 4 months ago

savetheclocktower commented 4 months ago

…of the form (select|delete|cut|move)To(Beginning|End)OfLine.

Also add most permutations of the form (select|delete|cut|move)To(Beginning|End)Of(Screen|Buffer)Line.

The ambiguous names are the ones that do not specify whether they operate on buffer coordinates or screen coordinates, and their behavior is inconsistent as a result. The behavior of each existing ambiguous method is preserved; the old method names are now aliases for the new ones.

This is a work in progress; the same work should be done in aliasing the respective command names that map to the old methods, plus creating new command names for the new methods.

Fixes #1041 — or at least I imagine it will once it's out of draft.

This is meant to be a collaboration, which is why I've created it on the pulsar-edit source. My goal here is not to forget the work of #810; it's as follows:

savetheclocktower commented 4 months ago

A couple of these test failures are legitimate and need fixing by yours truly. deleteToEndOfLine has a weird behavior where, if it's at the end of the buffer line, it deletes the subsequent newline. That's strange to me when we're talking about a method that operates on screen lines. I changed it to a no-op in that scenario, but I'll change it back so that it doesn't break the tests.