summaryrefslogtreecommitdiff
path: root/src/string_vec.h
AgeCommit message (Collapse)Author
2023-04-17Add --matching-algorithm option.Phil Jones
This replaces the --fuzzy-match algorithm. Available choices are normal, prefix and fuzzy. Levenshtein distance was investigated, but it seems pretty rubbish for tofi's use case, where you normally want a good match when you've only typed a small portion of the target string.
2022-11-28Refactor string vector code.Phil Jones
Previously, string vectors were built by reading input line-by line, and multiple copies of string vectors were made when searching. Now, input is read into one big buffer, and string vectors only contain references to the strings in this buffer. This both speeds up reading of input, and avoids unnecessary copying of strings in various places. The main downside currently is that input read from stdin is no longer UTF-8 normalised. This means, for example, that a search for `e` won't necessarily match `é`. Normalisation is very slow relative to the rest of tofi, however, and not needed for most use-cases. This could either be solved by accepting the slowdown, or making this an option, such as --unicode or --unicode-normalize.
2022-11-19Make vector finding functions names clearer.Phil Jones
This adds `_sorted` to the names of `string_vec_find` and `desktop_vec_find`, to make it clear that these functions require their input to already be sorted. Also fix a potential bug from not sorting the list of desktops in drun mode.
2022-11-19Fix sorting in normal tofi mode with history.Phil Jones
By using a hash table rather than binary search to find existing items, we can avoid the need to sort the input.
2022-11-19Cleanup some potentially flaky logic.Phil Jones
Some of the string vec code was still assuming that it was just a list of `char *`s, rather than `struct scored_string`s. Correcting that makes future changes a little less error prone, and allows significantly simpler history sorting for tofi-run.
2022-08-12Add --fuzzy_match option.Phil Jones
This enables some simple fuzzy matching logic for searches.
2022-08-02Add a few more function attributes.Phil Jones
2022-07-26Add keyword matching for drun searches.Phil Jones
There's starting to be a fair amount of duplicated code between the drun and normal run modes. At some point in the future, it's likely to be worth combining them, such that there's only a single `struct search_item` or similar, and just handle the different modes at the start and end of execution.
2022-07-05Fix typo.Phil Jones
Probably a good idea to allow more than 128 runs of a program.
2022-07-05Sort results by match position.Phil Jones
Search results will now be sorted by history first, then by the position of the match, such that a match at the start of a result will appear before a match later in the result.
2022-06-21Add config file handling.Phil Jones
Single letter style arguments have been removed.
2022-06-11Add compgen caching.Phil Jones
A list of commands is now stored in $XDG_CACHE_HOME/.cache/tofi-compgen, and regenerated as necessary.
2021-11-17Add sorting by run frequency.Phil Jones
This implements a rofi-like run cache. Other smaller changes include simplification of resize logic now that there's only one surface.
2021-11-15Multiple smaller changes.Phil Jones
- Remove the background image and libpng dependency - Add a prompt - Add xmalloc with out-of-memory handling - Add beginnings of a rofi-like run cache
2021-11-07Initial working build.Phil Jones
2021-11-06Start conversion to tofi.Phil Jones