Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Proposal: text entry highlight/select functionality #98

Open
IngCr3at1on opened this issue Jan 5, 2018 · 4 comments
Open

Proposal: text entry highlight/select functionality #98

IngCr3at1on opened this issue Jan 5, 2018 · 4 comments

Comments

@IngCr3at1on
Copy link

Basically I'd like to be able to highlight text in an entry without modifying it.

One use for this (my use) is a MUD client where you want to highlight the input text (automatically) to be able to erase it all with a single backspace (as an alternative to automatically clearing the text for the player).

@marcusolsson
Copy link
Owner

Hm, the first thing that comes to my mind is that Entry.Draw would have to somehow intelligently assign style names to part of the text. Not sure how you would specify the text to be highlighted, maybe something like entry.SetStyleNameRange("misspelled", 5, 3), where 5 is the offset from where the highlight should start and 3 is how many characters should be highlighted.

@IngCr3at1on
Copy link
Author

@marcusolsson that could work however my title for this issue is a bit of a misnomer as what we're talking about is less about highlighting and more about selecting the text; so that it can all be erased with a single backspace instead of having to backspace through the complete text.

In that sense it's more than just a style issue...

@IngCr3at1on IngCr3at1on changed the title Proposal: text entry highlight functionality Proposal: text entry highlight/select functionality Jan 5, 2018
@marcusolsson
Copy link
Owner

Selection is definitely on the roadmap. Both using mouse and programmatically, to define ranges. I don't have any specific solution in mind but here are some thoughts:

  • Selection would have to be specified in "content space" as opposed to view space where word wrap would have to be taken into account.
  • Ideally, both non-editable text (Label) and editable text (RuneBuf) would support selection.

Basic functionality would include:

  • Adding a range selection with [start, end]
  • Removing a range selection with [start, end]
  • Clearing all ranges

@IngCr3at1on
Copy link
Author

@marcusolsson aye makes sense except I still think selection and highlighting go hand-in-hand so "content-space" wouldn't really work entirely; after-all you want to be able to tell that you selected text (by highlighting it in some way) that's going to effects view space.

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

No branches or pull requests

2 participants