Youda008 / DoomRunner

Preset-oriented graphical launcher of various ported Doom engines (an alternative to ZDL)
GNU General Public License v3.0
205 stars 13 forks source link

[Feature] Search Function #70

Closed ibin7777 closed 11 months ago

ibin7777 commented 1 year ago

First of all, sincere apology for posting this many requests these days, considering that you have mentioned about hte scaling down. But I really like this launcher and want it to be better. I would happily do it myself and pull if I know C++🤦‍♂️

However I'd imagine this is not a hard one to do: image You see I have a lot of presets, and I don't like sorting them in alphabetical order, which sometime could be a mess when I'm looking for a specific one So it would be great if the launcher has a search bar or something.

But also if you don't have time to do it it's totally understandable.

Youda008 commented 1 year ago

I just found out about a feature that is there by default and i didn't even know. If you click somewhere into the preset list (to get focus) and press first few letters of some preset, it will automatically jump to it. For example, if you press 'B' it will jump to the first item starting with B (in your case BrutalDoom64. If you press B A R, it will jump to Barista, etc. This is like a light-weight seach that will find items by the beginning of their name. Of course if you type a word that is in the middle of the preset name, it will not work, but still nice to know.

ibin7777 commented 1 year ago

I just found out about a feature that is there by default and i didn't even know. If you click somewhere into the preset list (to get focus) and press first few letters of some preset, it will automatically jump to it. For example, if you press 'B' it will jump to the first item starting with B (in your case BrutalDoom64. If you press B A R, it will jump to Barista, etc. This is like a light-weight seach that will find items by the beginning of their name. Of course if you type a word that is in the middle of the preset name, it will not work, but still nice to know.

Hmmm it is strange that somehow it works diffenetly on my side. I'm using doomrunner 1.6.5 on windows 11 So I tried out the step you mentioned, when I type the first letter it worked like you said, it jumped to the first preset that started with that letter But when I try to continue typing, it just takes me to other mod that starts with those letters instead.

Berzasperd commented 1 year ago

So this letter-jump style search is something that is facilitated by Windows itself, if I understand correctly. As Youda said, it only works in sequence, meaning it will only look at the start of the preset name. Here's a couple of key points about this feature, one of which should help with your issue with it.

  1. Pressing a key on the keyboard while the Presets field is in focus (i.e. the last area of the screen you clicked on) will cause the selected item to jump to the first entry on the list starting with that letter or number. This works in other fields too, so having the right one "in focus" as they say is required. E.g. press B to jump to the first preset named B, based on the order in which they appear in the Presets list. The Presets list is not sorted, but each entry can be moved. The jump-search will always goes from top to bottom, not alphabetically.
  2. Pressing the same key again (after a short delay) will move the selection to the next entry with that letter or number on the list. The delay is the factor here. It seems to be somewhere between ~500 ms to ~1500 ms [needs verification]. You must wait until after this time window has passed to move to the next entry.
  3. Pressing multiple keys quickly will take you to the first entry that starts with all of the keys that were pressed in that sequence. E.g. pressing B then R then U quickly will take you from "Boom" to "Brutal Doom". *This is that same time window as before in note 2, where you must press the keys in the correct sequence within the allotted time in order for it to narrow down the jump-search to the specific entry. Once that window of time passes, the jump-search will "reset" and take the next key pressed as the "first" key to search for.
  4. All of the above seems to work with letters, numbers, and symbols, even symbols requiring Shift to type such as "!". These rules also apply to Separators in the Presets list, and everything follows the top-down rule, as opposed to alphabetical.

The takeaway here is that if you want to find something specific, you must type the correct sequence in order and in a fairly short time frame in order to home in on the one you want. You will also need to know what the name starts with, rather than a word within the name, as that will not work. If you are trying to scroll through different entries that start with the same letter, you will have to wait a few moments before pressing the same key again, or else it will interpret it as you doing a multi-key search.

None of this is to say that a search feature wouldn't be useful for DoomRunner, this is just to address the preexisting features that can be uses so far. A good search feature would use a regex style search that would highlight or filter anything containing the search string, not just ones that start with it.

In the mean time, you'll be responsible for sorting all your presets. In addition to drag and drop sorting, you can also use Ctrl + Up arrow and Ctrl + Down arrow to move a selected entry one space at a time. With how the jump-search works, you can also name Separators something that uses less common symbols or numbers so that you can jump to sections of your list more quickly.

Edit 1: The terms "letter-jump" and "jump-search" are not official as far as I know, just something I am using to refer to these concepts colloquially.

Edit 2: It is entirely possible that Windows 11 has changed something about the way this works. I tested this on Windows 10. If it is indeed the OS hooking in some of these basic features, then it is possible Windows 11 changed it in some way.

FerrisWasTaken commented 1 year ago

I just found out about a feature that is there by default and i didn't even know. If you click somewhere into the preset list (to get focus) and press first few letters of some preset, it will automatically jump to it. For example, if you press 'B' it will jump to the first item starting with B (in your case BrutalDoom64. If you press B A R, it will jump to Barista, etc. This is like a light-weight seach that will find items by the beginning of their name. Of course if you type a word that is in the middle of the preset name, it will not work, but still nice to know.

Must be a problem on your side. I am running manjaro linux AUR release.

Anyway, can we have a Ctrl-F menu on the top, a simple regex search will do. It would really help and make it objectively better that ZDL. Thanks a lot for the work you have already done bte

Youda008 commented 1 year ago

Alright then. Seems like the demand for this is rather high.

FerrisWasTaken commented 1 year ago

Alright then

Thanks a lot !

FerrisWasTaken commented 1 year ago

@Youda008 Is it possible if the same search function could be implemented for all fields IWADs, Mods, Maps. I do not think it would be as useful but if the same thing could just be copied then kindly implement it. Thank you a lot for you work so far.

FerrisWasTaken commented 1 year ago

In case anyone is still interested in this feature and knows C++, there are The qt docs, it describes how to create a search feature. Sadly I still dont know C++.

Youda008 commented 1 year ago

Ok, this is gonna take time. It turns out this "simple feature" kinda breaks the core principles around which the the preset list (and all other lists) are designed. Problem is not how to find the entries, problems is how to display them so that everything else keeps working.

Youda008 commented 1 year ago

Hello. For those of you still following this, i have an early access preview of the search feature. I made quite a mess in the code trying to make this work, so some bugs are expected. Please try it out and report back with any bugs you find.

DoomRunner-1.8preview-Windows-64bit.zip

FerrisWasTaken commented 1 year ago

Hello. For those of you still following this, i have an early access preview of the search feature. I made quite a mess in the code trying to make this work, so some bugs are expected. Please try it out and report back with any bugs you find.

DoomRunner-1.8preview-Windows-64bit.zip

Just tried it out, it works really well ! Thanks a lot. I believe I have tested everything with the case sensitive and regex searches. Few bugs with the regex search

  1. .* and .+ do not work
  2. character classes are a bit weird as from my observation it is matching a substring so if I have a preset "Preset1" and the regex [^P] it seems to be matching this preset even though it should fail. I believe to prevent this regexes should not match substrings but instead match from the beginning of the string.
Youda008 commented 1 year ago
  1. .* and .+ do not work

It works fine for me 😮 It selects all the items in my list. What does it do for you?

  1. if I have a preset "Preset1" and the regex [^P] it seems to be matching this preset even though it should fail. I believe to prevent this regexes should not match substrings but instead match from the beginning of the string.

But that's how regexes are intended to work, they have always been doing this. https://regex101.com/r/xA275W/1 If you want to search items that don't start with P, you have to write ^(?!P)

FerrisWasTaken commented 1 year ago

if I have a preset "Preset1" and the regex [^P] it seems to be matching this preset even though it should fail. I believe to prevent this regexes should not match substrings but instead match from the beginning of the string.

But that's how regexes are intended to work, they have always been doing this. https://regex101.com/r/xA275W/1 If you want to search items that don't start with P, you have to write ^(?!P)

I see, I guess it is complete then. Will probably need more testing though.

FerrisWasTaken commented 1 year ago

@Youda008 Could you push the code to the repository, it is enough for me and I would like to use it natively on linux, thank you for your time and effort.

Youda008 commented 1 year ago

It's already there. I just can't make an official release yet until i sort out https://github.com/Youda008/DoomRunner/issues/105

FerrisWasTaken commented 1 year ago

It's already there

Oh, sorry didnt see it.

Youda008 commented 11 months ago

Done and released.