diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2021-01-05 14:45:12 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-01-11 20:12:34 +0100 |
commit | 958112c5a396815da7a731f406dbfd27bf713572 (patch) | |
tree | 49b8640137ba6e70072d5ade0bc8260abc59dc8e /IncSet.c | |
parent | a118928dee0874eef98be81531a98577c1ae3f7d (diff) |
Refactor setting filter and use safe strncpy
Diffstat (limited to 'IncSet.c')
-rw-r--r-- | IncSet.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -29,6 +29,13 @@ void IncSet_reset(IncSet* this, IncType type) { IncMode_reset(&this->modes[type]); } +void IncSet_setFilter(IncSet* this, const char* filter) { + IncMode* mode = &this->modes[INC_FILTER]; + size_t len = String_safeStrncpy(mode->buffer, filter, sizeof(mode->buffer)); + mode->index = len; + this->filtering = true; +} + static const char* const searchFunctions[] = {"Next ", "Prev ", "Cancel ", " Search: ", NULL}; static const char* const searchKeys[] = {"F3", "S-F3", "Esc", " "}; static const int searchEvents[] = {KEY_F(3), KEY_F(15), 27, ERR}; |