glvis
glvis copied to clipboard
Button to enter command
It may be nice to have a dedicated button that would then let you type in a command into the terminal, e.g. format. The idea is something similar to : in vim or Ctrl+Shift+P in vscode. : is an unused key at the moment and a potential candidate.
Some keys already require additional user input into the terminal (e.g. F5). Currently this is done using cin >> (ref) but this can lead to GLVis freezing if something erroneous is input (e.g. a string when a number is expected). I have a minimal prompt() function that could maybe be a starting point for input type checking and validation (ref).
For now, the easiest implementation would require inputting the command into the terminal, but eventually it would be nice to be able to directly input the command into the GLVis window.
@justinlaughlin, it may be more convenient to open a WIP/Draft PR for your branch https://github.com/GLVis/glvis/tree/number-formatting, and have the discussion there -- at least if you think you want to address this topic there. If the topic here will be addressed in a separate branch (or multiple branches), then keeping this separate from the number-formatting branch is okay.
@v-dobrev The number-formatting branch is actually for https://github.com/GLVis/glvis/issues/260. I think this should be a separate branch/PR. The only reason I mention it is that I implemented the prompt() function and figured it could be useful for the command inputs.
Here are a few options for the key that opens the "command mode":
Esc: not used at the moment, I think.Enter: it is currently used but the command it is bound to is not used so often, so probably not a big issue to change it.Tab: also not used at the moment, I think.
I like all of :, Esc and Tab.
I'd prefer we don't change Enter
A few thoughts on implementation details
- Categorize commands by function (filter, label, etc)
- Fuzzy token matching would be nice (
did you mean X?) - ? could be nice for seeing available commands / groups of commands. Currently it zooms out but I think that is unintentional (since / is to zoom out)
- Dump commands into a "
glvisscript" (this is a very nice feature of GLVis that could use more documentation) - Undo/Redo commands