Blightmud icon indicating copy to clipboard operation
Blightmud copied to clipboard

Keep last sent text in prompt but marked as selected (Mudlet behaviour)

Open eaceaser opened this issue 4 years ago • 2 comments

Allow for selection of input line text.

Text should be selectable via:

  • Keyboard input
    • SHIFT+<left arrow>, SHIFT+<right arrow>: select prev/next character
    • SHIFT+CTRL+<left arrow>, `SHIFT+CTRL+': select prev/next word
    • SHIFT+<up arrow>, SHIFT+<down arrow>: select entire input line? or select to EOL/beginning of line from current cursor position?
  • Mouse input

Typing should replace the selected text.

eaceaser avatar Aug 01 '21 17:08 eaceaser

I think as a first step in this issue we should do the following:

  • Update CommandBuffer in src/ui/command.rs to hold a selection_range: Option<(usize, usize)>
  • If a selection exists when typing a char that is not Enter/Left/Right etc. Then the selection should be replaced with the recently typed char. (Write tests for this)
  • Include this range when sending the Event::UserInputBuffer (deal with all the areas where this needs to be dealt with).
  • Make the UI display selections if they exist, using a background color (I'm thinking blue but I'm up for suggestions)

Further steps

After the above is in place and working.

  • Introduce a setting that makes last sent command "stay" in the prompt but completely selected (Mudlet behaviour)

If there is a demand, we feel like it

  • Introduce UI bindings for stepping and selecting (I don't see much use for this. But Solving the original request (Mudlet prompt logic) in this way should leave all doors open for the future.

LiquidityC avatar Aug 02 '21 10:08 LiquidityC

To summarize.

  • Allow the backend CommandBufferto handle selections.
  • Change the submit() function keep what was just submitted but set the selection range to include the entire line. (Based on a setting)
  • Make UI show selections.
  • Update docs on the setting.

Leave all possible extensions for possible future development. Just knowing that we could do it is good enough. I don't think there is any demand. I just want the selections to be done "right" from the start. :wink:

LiquidityC avatar Aug 02 '21 10:08 LiquidityC

Will this be something to opt into and not a default behaviour?

gesslar avatar Dec 28 '22 22:12 gesslar

Issue flagged as stale

github-actions[bot] avatar Oct 02 '23 19:10 github-actions[bot]