Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 1359:7daf906fbcdc
The command /quit can be used in bindings, hooks and sourced files
(It used to work in bindings only)
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 11 Nov 2007 13:05:57 +0100 |
parents | 7bbfb0073f88 |
children | a0deb5124ebf |
comparison
equal
deleted
inserted
replaced
1358:005df14df743 | 1359:7daf906fbcdc |
---|---|
3695 return -1; | 3695 return -1; |
3696 } | 3696 } |
3697 | 3697 |
3698 // process_key(key) | 3698 // process_key(key) |
3699 // Handle the pressed key, in the command line (bottom). | 3699 // Handle the pressed key, in the command line (bottom). |
3700 int process_key(keycode kcode) | 3700 void process_key(keycode kcode) |
3701 { | 3701 { |
3702 int key = kcode.value; | 3702 int key = kcode.value; |
3703 int display_char = FALSE; | 3703 int display_char = FALSE; |
3704 | 3704 |
3705 lock_chatstate = false; | 3705 lock_chatstate = false; |
3710 case MKEY_EQUIV: | 3710 case MKEY_EQUIV: |
3711 key = kcode.value; | 3711 key = kcode.value; |
3712 break; | 3712 break; |
3713 case MKEY_META: | 3713 case MKEY_META: |
3714 default: | 3714 default: |
3715 if (bindcommand(kcode) == 255) | 3715 if (bindcommand(kcode) == 255) { |
3716 return 255; | 3716 mcabber_set_terminate_ui(); |
3717 return; | |
3718 } | |
3717 key = ERR; // Do not process any further | 3719 key = ERR; // Do not process any further |
3718 } | 3720 } |
3719 | 3721 |
3720 if (kcode.utf8) { | 3722 if (kcode.utf8) { |
3721 if (key != ERR && !kcode.mcode) | 3723 if (key != ERR && !kcode.mcode) |
3729 break; | 3731 break; |
3730 case 9: // Tab | 3732 case 9: // Tab |
3731 readline_do_completion(); | 3733 readline_do_completion(); |
3732 break; | 3734 break; |
3733 case 13: // Enter | 3735 case 13: // Enter |
3734 if (readline_accept_line(FALSE) == 255) | 3736 if (readline_accept_line(FALSE) == 255) { |
3735 return 255; | 3737 mcabber_set_terminate_ui(); |
3738 return; | |
3739 } | |
3736 break; | 3740 break; |
3737 case 3: // Ctrl-C | 3741 case 3: // Ctrl-C |
3738 scr_handle_CtrlC(); | 3742 scr_handle_CtrlC(); |
3739 break; | 3743 break; |
3740 case KEY_RESIZE: | 3744 case KEY_RESIZE: |
3749 if (kcode.utf8 ? iswprint(key) : (isprint(key) && !is_speckey(key))) { | 3753 if (kcode.utf8 ? iswprint(key) : (isprint(key) && !is_speckey(key))) { |
3750 char tmpLine[INPUTLINE_LENGTH+1]; | 3754 char tmpLine[INPUTLINE_LENGTH+1]; |
3751 | 3755 |
3752 // Check the line isn't too long | 3756 // Check the line isn't too long |
3753 if (strlen(inputLine) + 4 > INPUTLINE_LENGTH) | 3757 if (strlen(inputLine) + 4 > INPUTLINE_LENGTH) |
3754 return 0; | 3758 return; |
3755 | 3759 |
3756 // Insert char | 3760 // Insert char |
3757 strcpy(tmpLine, ptr_inputline); | 3761 strcpy(tmpLine, ptr_inputline); |
3758 ptr_inputline = put_char(ptr_inputline, key); | 3762 ptr_inputline = put_char(ptr_inputline, key); |
3759 strcpy(ptr_inputline, tmpLine); | 3763 strcpy(ptr_inputline, tmpLine); |
3760 check_offset(1); | 3764 check_offset(1); |
3761 } else { | 3765 } else { |
3762 // Look for a key binding. | 3766 // Look for a key binding. |
3763 if (!kcode.utf8 && (bindcommand(kcode) == 255)) | 3767 if (!kcode.utf8 && (bindcommand(kcode) == 255)) { |
3764 return 255; | 3768 mcabber_set_terminate_ui(); |
3769 return; | |
3770 } | |
3765 } | 3771 } |
3766 } | 3772 } |
3767 | 3773 |
3768 if (completion_started && key != 9 && key != KEY_RESIZE) | 3774 if (completion_started && key != 9 && key != KEY_RESIZE) |
3769 scr_end_current_completion(); | 3775 scr_end_current_completion(); |
3777 else | 3783 else |
3778 set_chatstate(1); | 3784 set_chatstate(1); |
3779 if (chatstate) | 3785 if (chatstate) |
3780 time(&chatstate_timestamp); | 3786 time(&chatstate_timestamp); |
3781 } | 3787 } |
3782 return 0; | 3788 return; |
3783 } | 3789 } |
3784 | 3790 |
3785 #ifdef HAVE_ASPELL_H | 3791 #ifdef HAVE_ASPELL_H |
3786 // Aspell initialization | 3792 // Aspell initialization |
3787 void spellcheck_init(void) | 3793 void spellcheck_init(void) |