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

Impossible to select whole line #58

Closed
koterpillar opened this issue Mar 31, 2017 · 5 comments
Closed

Impossible to select whole line #58

koterpillar opened this issue Mar 31, 2017 · 5 comments

Comments

@koterpillar
Copy link

When the following text is displayed in the terminal:

First line
Second line

It is impossible to select "First line" with the ending newline by itself.

If I drag the mouse to before "S" in "Second line", it is impossible not to select "S", so the smallest possible selection is First line\nS.

kitty-selection

If I drag the mouse past the end of "First line" (on the same line), "First line" is selected, followed by all the whitespace between the end of the line and mouse position. Note that other terminals in this case select First line\n, though selecting just First line is acceptable too.

@kovidgoyal
Copy link
Owner

I cannot replicate this, Dragginf from F to e selects the text "First line" with no trailing newline. Triple clicking the line also selects "First line"

I'm not particularly interested in trying to implement a way to get the trailing newline into the selection, since this is impossible to do robustly, think of the case when the last character in the line is also the last cell of the terminal display

@koterpillar
Copy link
Author

Triple click works for a single line, but there doesn't seem to be a way to select several?

Dragging exactly to the end of the line works, but that requires concentration (hello Fitts's law). It would make more sense if the trailing spaces were stripped from the end (this is indeed the behavior of other terminals I've tried).

@kovidgoyal
Copy link
Owner

Huh? Dragging past the end of the line in most terminals does not strip trailing spaces -- I tested termite, xterm and konsole. And you can select a single line easily using triple click. If you need to select multiple, a little precision is required, that is generally true for selecting any region.

@koterpillar
Copy link
Author

Here's what I mean by selecting multiple lines:

kitty-selection

Dragging the mouse from the left dot to the right copies:

[66326.871547] iwlwifi 0000:04:00.0: L1 Enabled - LTR Enabled
[66326.871977] iwlwifi 0000:04:00.0: L1 Enabled - LTR Enabled
[66326.959251] IPv6: ADDRCONF(NETDEV_UP): wlp4s0: link is not ready
[66326.961458] IPv6: ADDRCONF(NETDEV_UP): enp0s31f6: link is not ready            

Note the spaces on the last line (and only the last line). Doing the same movement in xterm or termite trims the last line properly.

Here's trying to select multiple lines by dragging to the start of the next line. I dragged the mouse from the upper to the lower dot:

kitty-selection-2

This copies the opening bracket on the end, whereas both xterm and termite do not select or copy it if the cursor is before the character.

I think I've found the place where the selection logic happens, will you accept a pull request changing the behavior in line with the other terminals?

@kovidgoyal
Copy link
Owner

Sure, send a PR. I cannot promise I will accept it, but, I will review it. Note that you cannot just blindly insert a newline at the end of the last line. You have to check if the next line is continued or not. If it is -- no newline, if it isn't, add a newline.

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

No branches or pull requests

2 participants