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

End of line behavior for command to transpose characters #805

Open
portstrom opened this Issue Sep 16, 2018 · 7 comments

Comments

Projects
None yet
6 participants
@portstrom

portstrom commented Sep 16, 2018

Xi has a command called transpose. It works similarly to the command transpose-chars in Emacs, but doesn't get the end of the line behavior right. From the Emacs manual:

Normally, C-t transposes the two characters on either side of point. When given at the end of a line, rather than transposing the last character of the line with the newline, which would be useless, C-t transposes the last two characters on the line. So, if you catch your transposition error right away, you can fix it with just a C-t.

@scholtzan

This comment has been minimized.

Show comment
Hide comment
@scholtzan

scholtzan Sep 16, 2018

Member

The current behaviour for transpose is pretty much the same as in Sublime. There it also swaps the last character of the line with the one on the next line. I am not sure which behaviour should be preferred.

Member

scholtzan commented Sep 16, 2018

The current behaviour for transpose is pretty much the same as in Sublime. There it also swaps the last character of the line with the one on the next line. I am not sure which behaviour should be preferred.

@cmyr

This comment has been minimized.

Show comment
Hide comment
@cmyr

cmyr Sep 17, 2018

Member

We have in general chosen ST3 as a model when nitting various little behaviours, and I'm happy with that choice.

In this case, both approaches address the fundamental problem that transposing a newline is probably not helpful; and if we pretend that newlines don't exist, transposing with the next non-newline character makes sense to me. If there's a specific utility-based argument for the other approach I'm happy to hear it.

Member

cmyr commented Sep 17, 2018

We have in general chosen ST3 as a model when nitting various little behaviours, and I'm happy with that choice.

In this case, both approaches address the fundamental problem that transposing a newline is probably not helpful; and if we pretend that newlines don't exist, transposing with the next non-newline character makes sense to me. If there's a specific utility-based argument for the other approach I'm happy to hear it.

@portstrom

This comment has been minimized.

Show comment
Hide comment
@portstrom

portstrom Sep 17, 2018

The quote from the Emacs manual makes it clear why that behavior is preferred and why the other behavior is even considered useless. In general I think Emacs and Vi are going to have every text related feature more well-designed than any editor with a shorter history. I assume the feature in Sublime works differently not because it was a conscious design choice, but simply because the author of Sublime never used Emacs, and doesn't know how useful this feature can be when implemented properly.

If you insist on having the Sublime feature, you can simply make two different commands for the two features, and any frontend can choose which one to use, or let the user configure the choice. The Sublime feature will however, as the Emacs manual says, be useless.

portstrom commented Sep 17, 2018

The quote from the Emacs manual makes it clear why that behavior is preferred and why the other behavior is even considered useless. In general I think Emacs and Vi are going to have every text related feature more well-designed than any editor with a shorter history. I assume the feature in Sublime works differently not because it was a conscious design choice, but simply because the author of Sublime never used Emacs, and doesn't know how useful this feature can be when implemented properly.

If you insist on having the Sublime feature, you can simply make two different commands for the two features, and any frontend can choose which one to use, or let the user configure the choice. The Sublime feature will however, as the Emacs manual says, be useless.

@raphlinus

This comment has been minimized.

Show comment
Hide comment
@raphlinus

raphlinus Oct 2, 2018

Contributor

The existing behavior was a deliberate choice (mostly because I felt Sublime was a good model to follow), but if people have strong preferences I'm willing to change it.

Contributor

raphlinus commented Oct 2, 2018

The existing behavior was a deliberate choice (mostly because I felt Sublime was a good model to follow), but if people have strong preferences I'm willing to change it.

@cmyr cmyr removed the hacktoberfest label Oct 10, 2018

@cmyr

This comment has been minimized.

Show comment
Hide comment
@cmyr

cmyr Oct 15, 2018

Member

closed in #847. If we want to make this a config option at some point we can revisit.

Member

cmyr commented Oct 15, 2018

closed in #847. If we want to make this a config option at some point we can revisit.

@sidsrvstv

This comment has been minimized.

Show comment
Hide comment
@sidsrvstv

sidsrvstv Oct 15, 2018

Are there any issues I can help out with?

sidsrvstv commented Oct 15, 2018

Are there any issues I can help out with?

@jansol

This comment has been minimized.

Show comment
Hide comment
@jansol

jansol Oct 15, 2018

Collaborator

@sidsrvstv sure, feel free to claim any issue tagged as "help wanted" or "hacktoberfest", those have been identified as mostly self-contained projects that should be easy to get started with.

Those issues should have good enough descriptions to get started. If that is not the case, please do ask for clarification in that issue's discussion.

If you have access to a mac you an also help out with xi-mac

Collaborator

jansol commented Oct 15, 2018

@sidsrvstv sure, feel free to claim any issue tagged as "help wanted" or "hacktoberfest", those have been identified as mostly self-contained projects that should be easy to get started with.

Those issues should have good enough descriptions to get started. If that is not the case, please do ask for clarification in that issue's discussion.

If you have access to a mac you an also help out with xi-mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment