minetest / minetest

Luanti (formerly Minetest) is an open source voxel game-creation platform with easy modding and game creation
https://www.minetest.net/
Other
10.85k stars 2.04k forks source link

Better Irrlicht/formspecs Textareas #15154

Open swagtoy opened 2 months ago

swagtoy commented 2 months ago

New Issue

Formspec textareas and textboxes could use some improvements and quality of life features. Ctrl + arrow keys to move by word for example.

Original issue (Emacs) ### Problem I have a nasty habit with Emacs bindings. They are primed onto my brain and I can't get away from them. Lots of software, even GTK and such, offer some sort of basic Emacs bindings. I'm sure even some of US use Emacs bindings since we... well, might write Lua mods in Emacs (well, I use QT Creator these days.. with emacs bindings) There are lots of mods that offer full textboxes (usually to write ACTUAL Lua code, oddly enough) and even simple ones. I think this would just be a cool "quality of life" thing, and consistancy with stuff like Gettext and GTK and GNU Emacs which already supports Emacs bindings. ### Solutions Add basic bindings like Ctrl-{A,E}, Ctrl-{<,>}, Ctrl-W, {Alt,Ctrl}-V, {Alt,Ctrl}-{F,B,P,N}, etc etc etc; as an option you can set in the engine. ### Alternatives Add (inferior) Vi-style bindings.. but seriously, we don't _need_ those, unless someone here can pitch a valid reason why they'd ever want that (If you're insane). Emacs bindings are just easy code to write and don't need modes, and that's why they are shoved into lots of different software. ### Additional context M-x Butterfly Here's a case where it could be useful, I've seen this with those Computercraft mods: ![screenshot_20240912_043647](https://github.com/user-attachments/assets/8b9e6292-0aaf-40b4-9b10-7e88e6b0540a)
swagtoy commented 2 months ago

We can probably look for GTK's config file, then look for gtk-key-theme-name = Emacs within ~/.config/gtk-3.0/settings.ini. It looks like gtk4 uses gsettings though (is this just a fancy command line tool to enable settings in said file?), which is a no-go...

v-rob commented 2 months ago

I do not think we should support either Emacs or Vi(m) bindings, even as a setting. It's simply too esoteric to have to maintain that. However, we definitely should support more keyboard shortcuts that standard GUIs like Windows, GTK, Qt, etc. all support. For instance, Ctrl+Right is standard in most GUIs to move forwards one word, but we don't support that.

If we did support custom keybindings in formspecs, we would probably have a keybinding menu, just like we have for in-game controls.

(Also, Vim's modal editing is clearly superior to any other editor. Not a good reason to include it in Minetest, but just sayin'.)

swagtoy commented 2 months ago

It's only slightly esoteric, but I agree, we should REALLY do the more traditional keybinds first.

But still, I feel like some basic Emacs bindings couldn't hurt on the side, like C-{f,b,p,n}. It's... not that esoteric, as every GNU Gettext program supports these by default and some software does as well, Even macOS supports Emacs bindings in software!! Clear sign it's not too esoteric :^)

Maybe we should just add it as a bonus to some Ctrl+arrow keybinds. It doesn't interfere with anything to add the basic ones that most software support (Ctrl+A for example thougn, WOULD interfere with Select all, so we can just not add that...)

I don't like custom keybindings for that though, I don't think someone will actually want to customize, say, Ctrl+right functionality or add their own bindings for formspecs.

ryvnf commented 2 months ago

Emacs bindings in formspecs feels very niche.

I do however think the console should support Emacs/Readline-style bindings. I think that would benefit a lot of people who are used to command-line editing in interpreters like Bash/Python/Lua. That is however a different feature request. Might make a different issue about it.

I think the use case for console is a lot stronger when Readline-style bindings are "standard" in command line editing. Formspecs more correspond to regular GUI editing were I would assume less than 1 % of users use Emacs bindings.

swagtoy commented 2 months ago

Yeah, i guess the target audience wouldn't think of it much. Again though, it's one of those "harmless" things that someone could just slip in there.

Control + left/right support would be a better priority. Maybe I should rename this issue and edit it?

hlqkj commented 2 months ago

Add (inferior) Vi-style bindings.. but seriously, we don't need those, unless someone here can pitch a valid reason why they'd ever want that (If you're insane).

Hey, I'm that insane you're talking about 🤣