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

Extend word selection #1023

Closed
cqexbesd opened this issue Feb 9, 2023 · 4 comments · Fixed by #1504 or #1518
Closed

Extend word selection #1023

cqexbesd opened this issue Feb 9, 2023 · 4 comments · Fixed by #1504 or #1518
Assignees
Labels
blocker:office Bug reported by my colleges, and hence should be fixed ASAP. :) enhancement New feature or request feature-request User requested features

Comments

@cqexbesd
Copy link
Contributor

cqexbesd commented Feb 9, 2023

Abstract

Double clicking on a word selects it. One more click and you get the whole line. I would like to have some steps in between, where a different set of word delimiters is used and you can keep growing your selection until you reach the line selection.

(I know this has been discussed but I didn't see it written down hence this issue)

Motivation

Using the default config, IPv6 addresses have to be dragged over to select with the mouse. URLs are similar. While I could change the delimiters to get them in one go, sometimes I do want to select just a small portion of something. I would prefer just one more click than having to drag or the many key presses needed to enter vi mode and navigate.

Specification

A choice has to be made if there will be two sets of word delimiters or if it can be any number the user chooses. Only having one more level would probably satisfy 80% of people. Either way the config should allow one or more new sets of delimiters to be specified.

When a user double clicks on some text the first set of delimiters is used to determine what is selected. If the user clicks once more in the same selection then the next set of delimiters are used to find the word boundaries and so on. When there are no more sets configured then the next click selects the whole line as it does now.

  • If a user doesn't provide more sets in their config then behaviour would remain as it is now.
  • A user could provide a series of smaller and smaller sets so repeated clicks makes the selection larger - but they could also provide larger sets causing the selection to shrink if that's what they desired. I don't see a need to enforce a single direction of growth so it would be possible (if perhaps annoying) to have selections grow and shrink as you click if that's how the user configured it.
@cqexbesd cqexbesd added enhancement New feature or request feature-request User requested features labels Feb 9, 2023
@christianparpart
Copy link
Member

I think supporting one additional selection delimiter configuration apart from word-wise but less than line wise, would make sense, but going beyond that I think, this would probably make things less usable for the user, as in: they might be getting confused by how many clicks they did and end up redoing the click-sequence again, just to get what they want.

So,

  • single click: starts linear selection
  • double click: selects word wise selection
  • if configured: one click more will select an extended word wise selection
  • one click more (3 or 4 times therefore) would do line wise selection

Going for more than one extra layer is certainly possible but I don't see how that could improve workflow. Users should probably be using vim-mode and motion sequences to quickly select a range).

That's just a thought so far.

So now, how would one configure it. Probably with an optional configuration key per profile that would have a name, something like, alternate_word_selection_delimiters or so, that accepts a string of all characters that are allowed to be part of such a word. (just like we have already, but for the alternate word selection, which can be triggered using 3-click).

@christianparpart christianparpart added the blocker:office Bug reported by my colleges, and hence should be fixed ASAP. :) label Feb 17, 2023
@zopieux
Copy link

zopieux commented Oct 10, 2023

I would disagree with the assumption that users would be confused. I agree it's a novel selection mode and therefore shouldn't be the default, but what OP described/requests here is very precisely what I believe is the most useful selection behavior for programmers / tech savvy folks, in a terminal, when using the mouse.

This is because in general, I always want to select things on a word boundary, but because I deal with various technical things and not English literature, the delimiters in question will be different from one time to another. Therefore no amount of devising the best heuristic will work. Just give me a mode that expands the selection to one more delimiter at a time, even if that means more clicks, and even if that means an arbitrary large amount of clicks might be necessary to reach the full line.

I hope I correctly rephrased OP's FR. I can relate — the status quo of mouse text selection in terminals is extremely frustrating today.

@cqexbesd
Copy link
Contributor Author

Thanks for this! Though now I have one extra level it really convinces me I wan't multiple :-)

e.g.http://[fd12:1:0:8:0:1:c0a8:4d69]/

For word selection in e.g. yaml files, : is in word_delimiters so the first double click in the IP gets just one 16 bit value. I have [] in extended_word_delimiters so another click and I get the IP, but one more and I get the line rather than the URL which would be want I would really like.

@Yaraslaut
Copy link
Member

Yaraslaut commented May 13, 2024

Thanks for this! Though now I have one extra level it really convinces me I wan't multiple :-)

e.g.http://[fd12:1:0:8:0:1:c0a8:4d69]/

For word selection in e.g. yaml files, : is in word_delimiters so the first double click in the IP gets just one 16 bit value. I have [] in extended_word_delimiters so another click and I get the IP, but one more and I get the line rather than the URL which would be want I would really like.

I see, I think that instead of adding another click during selection we can add user defined selection by delimiter, so you can add something like

    - { mods: [Control],        mouse: Left,        action: Select, chars: ' ' }

So during C+left click on the url it will select everything between spaces
what do you think about it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker:office Bug reported by my colleges, and hence should be fixed ASAP. :) enhancement New feature or request feature-request User requested features
Projects
None yet
4 participants