From 054fbe20e7c56a1753b654771271232065217491 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Jan 06 2021 20:10:52 +0000 Subject: Apply patch 0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch patch_name: 0004-src-augtool.c-hopefully-fix-readline-quoting-issues.patch present_in_specfile: true location_in_specfile: 4 --- diff --git a/src/augtool.c b/src/augtool.c index b42ef63..31a991e 100644 --- a/src/augtool.c +++ b/src/augtool.c @@ -267,10 +267,22 @@ static char *get_home_dir(uid_t uid) { return result; } +/* Inspired from: + * https://thoughtbot.com/blog/tab-completion-in-gnu-readline + */ +static int quote_detector(char *str, int index) { + return index > 0 + && str[index - 1] == '\\' + && quote_detector(str, index - 1) == 0; +} + static void readline_init(void) { rl_readline_name = "augtool"; rl_attempted_completion_function = readline_completion; rl_completion_entry_function = readline_path_generator; + rl_completer_quote_characters = "\"'"; + rl_completer_word_break_characters = (char *) " "; + rl_char_is_quoted_p = "e_detector; /* Set up persistent history */ char *home_dir = get_home_dir(getuid());