Mercurial > hg
comparison mcabber/src/screen.c @ 758:402b0e288433
Enable "meta" key
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Fri, 17 Mar 2006 17:12:04 +0100 |
parents | 1877838d3c27 |
children | a681dc477c7f |
comparison
equal
deleted
inserted
replaced
757:ae23c8826efb | 758:402b0e288433 |
---|---|
1822 refresh_inputline(); | 1822 refresh_inputline(); |
1823 } | 1823 } |
1824 | 1824 |
1825 int scr_Getch(void) | 1825 int scr_Getch(void) |
1826 { | 1826 { |
1827 int ch; | 1827 return wgetch(inputWnd); |
1828 ch = wgetch(inputWnd); | |
1829 return ch; | |
1830 } | 1828 } |
1831 | 1829 |
1832 // process_key(key) | 1830 // process_key(key) |
1833 // Handle the pressed key, in the command line (bottom). | 1831 // Handle the pressed key, in the command line (bottom). |
1834 int process_key(int key) | 1832 int process_key(int key) |
1835 { | 1833 { |
1836 switch(key) { | 1834 if (key == 27) { |
1835 key = scr_Getch(); | |
1836 if (key == -1 || key == 27) { | |
1837 // This is a "real" escape... | |
1838 scr_CheckAutoAway(TRUE); | |
1839 currentWindow = NULL; | |
1840 chatmode = FALSE; | |
1841 if (current_buddy) | |
1842 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE); | |
1843 scr_RosterVisibility(1); | |
1844 scr_UpdateChatStatus(FALSE); | |
1845 top_panel(chatPanel); | |
1846 top_panel(inputPanel); | |
1847 update_panels(); | |
1848 } else { // Meta | |
1849 switch (key) { | |
1850 default: | |
1851 scr_LogPrint(LPRINT_NORMAL, "Unknown key=M%d", key); | |
1852 } | |
1853 } | |
1854 key = -1; | |
1855 } | |
1856 switch (key) { | |
1857 case -1: | |
1858 break; | |
1837 case 8: // Ctrl-h | 1859 case 8: // Ctrl-h |
1838 case 127: // Backspace too | 1860 case 127: // Backspace too |
1839 case KEY_BACKSPACE: | 1861 case KEY_BACKSPACE: |
1840 if (ptr_inputline != (char*)&inputLine) { | 1862 if (ptr_inputline != (char*)&inputLine) { |
1841 char *c = --ptr_inputline; | 1863 char *c = --ptr_inputline; |
1949 case 20: // Ctrl-t | 1971 case 20: // Ctrl-t |
1950 readline_transpose_chars(); | 1972 readline_transpose_chars(); |
1951 break; | 1973 break; |
1952 case 23: // Ctrl-w | 1974 case 23: // Ctrl-w |
1953 readline_backward_kill_word(); | 1975 readline_backward_kill_word(); |
1954 break; | |
1955 case 27: // ESC | |
1956 scr_CheckAutoAway(TRUE); | |
1957 currentWindow = NULL; | |
1958 chatmode = FALSE; | |
1959 if (current_buddy) | |
1960 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE); | |
1961 scr_RosterVisibility(1); | |
1962 scr_UpdateChatStatus(FALSE); | |
1963 top_panel(chatPanel); | |
1964 top_panel(inputPanel); | |
1965 update_panels(); | |
1966 break; | 1976 break; |
1967 case 12: // Ctrl-l | 1977 case 12: // Ctrl-l |
1968 scr_CheckAutoAway(TRUE); | 1978 scr_CheckAutoAway(TRUE); |
1969 scr_Resize(); | 1979 scr_Resize(); |
1970 redrawwin(stdscr); | 1980 redrawwin(stdscr); |