GLVis / glvis

Lightweight OpenGL tool for accurate and flexible finite element visualization
http://glvis.org
BSD 3-Clause "New" or "Revised" License
247 stars 50 forks source link

Button to enter command #287

Open justinlaughlin opened 1 month ago

justinlaughlin commented 1 month ago

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.

v-dobrev commented 1 month ago

@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.

justinlaughlin commented 1 month ago

@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.

v-dobrev commented 1 month ago

Here are a few options for the key that opens the "command mode":

tzanio commented 1 month ago

I like all of :, Esc and Tab.

I'd prefer we don't change Enter