summaryrefslogtreecommitdiff
path: root/src/entry.h
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-11-28 22:19:12 +0000
committerPhil Jones <philj56@gmail.com>2022-11-28 22:19:12 +0000
commit3861e8289ae40bac168275ce6f10b231e11baa55 (patch)
tree30093bb562e9718c60d3d36c9942ce4714c43488 /src/entry.h
parent574b523ab5d9b63a114ac905e5ff8494f4b2f233 (diff)
Refactor string vector code.
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.
Diffstat (limited to 'src/entry.h')
-rw-r--r--src/entry.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/entry.h b/src/entry.h
index a9353a5..4ee6316 100644
--- a/src/entry.h
+++ b/src/entry.h
@@ -55,8 +55,9 @@ struct entry {
uint32_t selection;
uint32_t first_result;
- struct string_vec results;
- struct string_vec commands;
+ char *command_buffer;
+ struct string_ref_vec results;
+ struct string_ref_vec commands;
struct desktop_vec apps;
struct history history;
bool use_pango;