Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ambiguity in all text movement method names… #1042

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

savetheclocktower
Copy link
Contributor

…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:

  • Ensure that there are no behavior changes from the existing deprecated methods. (Running the existing tests should demonstrate this.)
  • Write a bunch of new tests to prove that the new methods do the things they claim. Especially focus on tests that do lots of soft-wrapping and therefore vary wildly between buffer and screen coordinates.
  • Once all of that works, we should be able to change the implementations of these methods where needed to fix the underlying issue from Fix onDidChangeCursorPosition callback event property on deleting characters #810. We'll know we've done it right if all the tests keep passing.

…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.
@savetheclocktower savetheclocktower marked this pull request as draft June 28, 2024 23:49
@savetheclocktower
Copy link
Contributor Author

savetheclocktower commented Jun 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename some line-movement commands to remove confusion
1 participant