1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge pull request #1646 from MarcoPolo-PasTonMolo/fix/nick-autocomplete

Fix not autocompleting nicks with '/'
This commit is contained in:
Michael Vetter 2022-03-21 10:06:29 +01:00 committed by GitHub
commit 963065775b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -586,24 +586,28 @@ _inp_rl_tab_handler(int count, int key)
return 0; return 0;
} }
ProfWin* current = wins_get_current(); if (strncmp(rl_line_buffer, "/", 1) == 0) {
if ((strncmp(rl_line_buffer, "/", 1) != 0) && (current->type == WIN_MUC)) {
char* result = muc_autocomplete(current, rl_line_buffer, FALSE);
if (result) {
rl_replace_line(result, 1);
rl_point = rl_end;
free(result);
}
} else if (strncmp(rl_line_buffer, "/", 1) == 0) {
ProfWin* window = wins_get_current(); ProfWin* window = wins_get_current();
char* result = cmd_ac_complete(window, rl_line_buffer, FALSE); char* result = cmd_ac_complete(window, rl_line_buffer, FALSE);
if (result) { if (result) {
rl_replace_line(result, 1); rl_replace_line(result, 1);
rl_point = rl_end; rl_point = rl_end;
free(result); free(result);
return 0;
} }
} }
ProfWin* current = wins_get_current();
if (current->type == WIN_MUC) {
char* result = muc_autocomplete(current, rl_line_buffer, FALSE);
if (result) {
rl_replace_line(result, 1);
rl_point = rl_end;
free(result);
}
}
return 0; return 0;
} }
@ -614,17 +618,20 @@ _inp_rl_shift_tab_handler(int count, int key)
return 0; return 0;
} }
ProfWin* current = wins_get_current(); if (strncmp(rl_line_buffer, "/", 1) == 0) {
if ((strncmp(rl_line_buffer, "/", 1) != 0) && (current->type == WIN_MUC)) { ProfWin* window = wins_get_current();
char* result = muc_autocomplete(current, rl_line_buffer, TRUE); char* result = cmd_ac_complete(window, rl_line_buffer, TRUE);
if (result) { if (result) {
rl_replace_line(result, 1); rl_replace_line(result, 1);
rl_point = rl_end; rl_point = rl_end;
free(result); free(result);
return 0;
} }
} else if (strncmp(rl_line_buffer, "/", 1) == 0) { }
ProfWin* window = wins_get_current();
char* result = cmd_ac_complete(window, rl_line_buffer, TRUE); ProfWin* current = wins_get_current();
if (current->type == WIN_MUC) {
char* result = muc_autocomplete(current, rl_line_buffer, TRUE);
if (result) { if (result) {
rl_replace_line(result, 1); rl_replace_line(result, 1);
rl_point = rl_end; rl_point = rl_end;