Mercurial > hg
comparison mcabber/src/screen.c @ 100:8fedef290c4e
[/trunk] Changeset 114 by mikael
* Cleaning, add comments, remove debugging stuff...
author | mikael |
---|---|
date | Thu, 21 Apr 2005 17:21:49 +0000 |
parents | 7fffb8a6b229 |
children | 4f3ad00b5187 |
comparison
equal
deleted
inserted
replaced
99:7fffb8a6b229 | 100:8fedef290c4e |
---|---|
635 | 635 |
636 if (row == -1) return; // No completion if no leading slash | 636 if (row == -1) return; // No completion if no leading slash |
637 | 637 |
638 if (row == 0) { // Command completion | 638 if (row == 0) { // Command completion |
639 if (!completion_started) { | 639 if (!completion_started) { |
640 const char *cchar; | |
640 GSList *list = compl_get_category_list(COMPL_CMD); | 641 GSList *list = compl_get_category_list(COMPL_CMD); |
641 if (list) { | 642 if (list) { |
642 const char *cchar; | |
643 char *prefix = g_strndup(&inputLine[1], ptr_inputline-inputLine-1); | 643 char *prefix = g_strndup(&inputLine[1], ptr_inputline-inputLine-1); |
644 // Init completion | |
644 new_completion(prefix, list); | 645 new_completion(prefix, list); |
646 g_free(prefix); | |
647 // Now complete | |
645 cchar = complete(); | 648 cchar = complete(); |
646 if (cchar) | 649 if (cchar) |
647 scr_insert_text(cchar); | 650 scr_insert_text(cchar); |
648 g_free(prefix); | |
649 completion_started = TRUE; | 651 completion_started = TRUE; |
650 } | 652 } |
651 } else { | 653 } else { |
652 char *c; | 654 char *c; |
653 const char *cchar; | |
654 guint back = cancel_completion(); | 655 guint back = cancel_completion(); |
655 // Remove $back chars | 656 // Remove $back chars |
656 ptr_inputline -= back; | 657 ptr_inputline -= back; |
657 c = ptr_inputline; | 658 c = ptr_inputline; |
658 for ( ; *c ; c++) | 659 for ( ; *c ; c++) |
662 if (cchar) | 663 if (cchar) |
663 scr_insert_text(cchar); | 664 scr_insert_text(cchar); |
664 } | 665 } |
665 return; | 666 return; |
666 } | 667 } |
668 | |
669 // Other completion, depending on the command | |
667 scr_LogPrint("I'm unable to complete that yet"); | 670 scr_LogPrint("I'm unable to complete that yet"); |
668 } | 671 } |
669 | 672 |
670 void scr_cancel_current_completion(void) | 673 void scr_cancel_current_completion(void) |
671 { | 674 { |
680 | 683 |
681 void scr_end_current_completion(void) | 684 void scr_end_current_completion(void) |
682 { | 685 { |
683 done_completion(); | 686 done_completion(); |
684 completion_started = FALSE; | 687 completion_started = FALSE; |
685 scr_LogPrint("Freeing completion data"); | |
686 } | 688 } |
687 | 689 |
688 // check_offset(int direction) | 690 // check_offset(int direction) |
689 // Check inputline_offset value, and make sure the cursor is inside the | 691 // Check inputline_offset value, and make sure the cursor is inside the |
690 // screen. | 692 // screen. |