Add /clear autocompletion and improve help

Regards https://github.com/profanity-im/profanity/issues/855

https://github.com/profanity-im/profanity/pull/874 brought us the
`/clear` command. The author of that patch couldn't follow up with the
review boothj5 did.

So the autocompletion and updated help was missing.
This commit adds it.
This commit is contained in:
Michael Vetter
2019-10-05 16:19:53 +02:00
parent d7c00360ea
commit 684a9b1a56
3 changed files with 60 additions and 6 deletions

View File

@@ -5047,7 +5047,29 @@ cmd_tiny(ProfWin *window, const char *const command, gchar **args)
gboolean
cmd_clear(ProfWin *window, const char *const command, gchar **args)
{
win_clear(window);
if (args[0] == NULL) {
win_clear(window);
return TRUE;
} else {
if ((g_strcmp0(args[0], "persist_history") == 0) ) {
if (args[1] != NULL) {
if ((g_strcmp0(args[1], "on") == 0) || (g_strcmp0(args[1], "off") == 0)) {
_cmd_set_boolean_preference(args[1], command, "Persistant history", PREF_CLEAR_PERSIST_HISTORY);
return TRUE;
}
} else {
if (prefs_get_boolean(PREF_CLEAR_PERSIST_HISTORY)) {
win_println(window, THEME_DEFAULT, '!', " Persistantly clear screen : ON");
} else {
win_println(window, THEME_DEFAULT, '!', " Persistantly clear screen : OFF");
}
return TRUE;
}
}
}
cons_bad_cmd_usage(command);
return TRUE;
}