Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
0
Members

A little detail about "search"

A topic by Itooh created Aug 08, 2016 Views: 268 Replies: 3
Viewing posts 1 to 3

Hello! I've been using Superpowers since January, and I'm really enjoying it. I especially appreciate the integration of some Sublime's shortcuts (multiple cursors, YES!), and the recent adding of darker themes.

There's just a very small annoyance I still have: the search function in script editor. It certainly do its job, but it requires first pressing Ctrl+F, then Enter (after typing something of course), and finally F3 to browse results. And… Apparently that's too many steps for my little brain. I keep pressing F3 just after Ctrl+F, or using Enter to browse (which doesn't wok). Most editors I know has only to steps for searching (Ctrl+F, Enter, Ctrl+F F3, Ctrl-F arrows…).

It's a minor issue, yes. But it happens almost systematically, and keep breaking the flow. So I would like to suggest: after typing, could "F3" validate the search just like "Enter"? This way the GUI behavior doesn't change much, but searching require less moves.

If it's more complicated, I hope this remark has been useful anyway! :)

Moderator

Hi!

Search is provided by the CodeMirror editor widget. I think the best approach would be to submit an enhancement request or a patch to CodeMirror's search.js addon, and then update Superpowers to use that new version of CodeMirror. Would be much simpler than trying to fork and maintain our own version of it, which would become an on-going maintenance burden.

(4 edits)

CodeMirror is used? I guess that's good to learn. :)

I've just made some experiments with it, and it turns out it already has such a functionality! There are two commands for searching : "find", and "findPersistent". The second one isn't bound to any keys by default, but it is used in the search interface demo. It quite does the job: searching is immediate, and requires only to press one key.

All there is to do to integrate it is to add the command in extraKeys in the options on CodeMirror instantiation:

var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  mode: "text/html",
  lineNumbers: true,
  extraKeys: {"Alt-F": "findPersistent"}
});

I also tested it with the Sublime keyMap, and it works as well. The keys can overwrite an existing command by the way.

Maybe the best choice should be to keep the Find command as it is now, and bind this one to another key combination. Maybe "Shift-Ctrl-F", or "Alt-F" as in the demo (though it's not the most intuitive, but eh, that's mostly my opinion). That's up to you to decide.

Now that I'm thinking of it: are there any plans for a keys/shortcuts personal configurations?


Update: After exploring Superpower's source code, it seems to me this should be done in the textEditorWidget plugin. Should I create a pull request?

(1 edit)

A pull request would be much appreciated, so we can test it out, discuss & merge if it fits!

We (as in, the core dev team) don't have immediate plans for a full-blown keyboard shortcut customization UI but maybe someday, if someone comes up with a good design :)

Cheers!

(EDIT: That was Elisée, posting with the wrong account whoops)