comparison mcabber/mcabber/screen.c @ 2305:5b1a63dc2b1a

[PATCH 2/3] Don't complete "/search" string in vi mode If vi_mode is set to 1 and the user is currently in non-chat mode, disable completion when the input line starts with a slash. Only commands entered with a leading colon should be completed in this mode.
author Holger Weiß <holger@zedat.fu-berlin.de>
date Fri, 24 Jul 2015 02:37:07 +0200
parents fa8365fb6ac2
children 7afb9a0c6409
comparison
equal deleted inserted replaced
2304:fa8365fb6ac2 2305:5b1a63dc2b1a
4474 void scr_process_key(keycode kcode) 4474 void scr_process_key(keycode kcode)
4475 { 4475 {
4476 int key = kcode.value; 4476 int key = kcode.value;
4477 int display_char = FALSE; 4477 int display_char = FALSE;
4478 int vi_completion = FALSE; 4478 int vi_completion = FALSE;
4479 int vi_search = FALSE;
4479 static int ex_or_search_mode = FALSE; 4480 static int ex_or_search_mode = FALSE;
4480 4481
4481 lock_chatstate = FALSE; 4482 lock_chatstate = FALSE;
4482 4483
4483 switch (kcode.mcode) { 4484 switch (kcode.mcode) {
4507 clear_inputline(); 4508 clear_inputline();
4508 ex_or_search_mode = FALSE; 4509 ex_or_search_mode = FALSE;
4509 break; 4510 break;
4510 case 9: // Tab 4511 case 9: // Tab
4511 case 353: // Shift-Tab 4512 case 353: // Shift-Tab
4512 if (inputLine[0] == ':') { 4513 switch (inputLine[0]) {
4513 inputLine[0] = '/'; 4514 case ':':
4514 vi_completion = TRUE; 4515 inputLine[0] = '/';
4516 vi_completion = TRUE;
4517 break;
4518 case '/':
4519 vi_search = TRUE;
4520 break;
4515 } 4521 }
4516 break; 4522 break;
4517 case 13: // Enter 4523 case 13: // Enter
4518 case 343: // Enter on Maemo 4524 case 343: // Enter on Maemo
4519 switch (inputLine[0]) { 4525 switch (inputLine[0]) {
4749 switch (key) { 4755 switch (key) {
4750 case 0: 4756 case 0:
4751 case ERR: 4757 case ERR:
4752 break; 4758 break;
4753 case 9: // Tab 4759 case 9: // Tab
4754 readline_do_completion(TRUE); // Forward-completion 4760 if (!vi_search)
4761 readline_do_completion(TRUE); // Forward-completion
4755 break; 4762 break;
4756 case 353: // Shift-Tab 4763 case 353: // Shift-Tab
4757 readline_do_completion(FALSE); // Backward-completion 4764 if (!vi_search)
4765 readline_do_completion(FALSE); // Backward-completion
4758 break; 4766 break;
4759 case 13: // Enter 4767 case 13: // Enter
4760 case 343: // Enter on Maemo 4768 case 343: // Enter on Maemo
4761 readline_accept_line(FALSE); 4769 readline_accept_line(FALSE);
4762 break; 4770 break;