Remove autocomplete for /correct-editor

We decided that it was better to remove autocomplete for this command,
since adding it only introduced problems and the command can still
function perfectly without autocomplete.
This commit is contained in:
MarcoPolo-PasTonMolo
2021-10-21 17:01:54 +03:00
parent cd16264d2b
commit 6b0f15a1c9
4 changed files with 18 additions and 31 deletions

View File

@@ -1795,7 +1795,6 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
g_hash_table_insert(ac_funcs, "/avatar", _avatar_autocomplete);
g_hash_table_insert(ac_funcs, "/correction", _correction_autocomplete);
g_hash_table_insert(ac_funcs, "/correct", _correct_autocomplete);
g_hash_table_insert(ac_funcs, "/correct-editor", _correct_autocomplete);
g_hash_table_insert(ac_funcs, "/software", _software_autocomplete);
g_hash_table_insert(ac_funcs, "/url", _url_autocomplete);
g_hash_table_insert(ac_funcs, "/executable", _executable_autocomplete);
@@ -4031,6 +4030,17 @@ _correction_autocomplete(ProfWin* window, const char* const input, gboolean prev
static char*
_correct_autocomplete(ProfWin* window, const char* const input, gboolean previous)
{
GString* result_str = g_string_new("/correct ");
g_string_append(result_str, _get_last_message(window));
char* result = result_str->str;
g_string_free(result_str, FALSE);
return result;
}
char*
_get_last_message(ProfWin* window)
{
char* last_message = NULL;
switch (window->type) {
@@ -4055,27 +4065,7 @@ _correct_autocomplete(ProfWin* window, const char* const input, gboolean previou
return NULL;
}
// Get command
int len = strlen(input);
char command[len + 2];
int i = 0;
while (i < len) {
if (input[i] == ' ') {
break;
} else {
command[i] = input[i];
}
i++;
}
command[i] = ' ';
command[i + 1] = '\0';
GString* result_str = g_string_new(command);
g_string_append(result_str, last_message);
char* result = result_str->str;
g_string_free(result_str, FALSE);
return result;
return last_message;
}
static char*