Files
profanity/tests/unittests/command/test_cmd_ac.h
Michael Vetter 8dbd1e3253 fix: Fix file autocompletion bugs and restore cycling
Fix several issues in cmd_ac_complete_filepath:
* Prevent a segfault when input is empty.
* Fix a double free where acstring was managed by both auto_gchar and GArray.
* Fix a memory leak when reassigning inpcp during quote stripping.
* Restore the ability to cycle through files on repeated TAB presses by
  caching the last input and skipping updates if the input is already a
  known completion.
* Preserve user input style (e.g. ~, ./) in autocompletion strings to
  ensure matches are correctly displayed and filtered.

Bug got introduced when "cleaning" code with new compiler flags and
sanitizers: aec8e48268.
Add unit tests so this doesn't happen again.

Before that commit we didn't use the static variable but used
autocomplete_update instead. Now we avoid redundat updates and preserve
the state across tab presses. We should look at this again later.

Fix https://github.com/profanity-im/profanity/issues/2098
2026-03-01 01:26:14 +01:00

10 lines
345 B
C

#ifndef TESTS_TEST_CMD_AC_H
#define TESTS_TEST_CMD_AC_H
void cmd_ac_complete_filepath__segfaults_when_empty(void** state);
void cmd_ac_complete_filepath__finds_files_in_current_dir(void** state);
void cmd_ac_complete_filepath__finds_files_with_dot_slash(void** state);
void cmd_ac_complete_filepath__cycles_through_files(void** state);
#endif