Mercurial > hg > nnchat
comparison nnchat.c @ 77:e8c9d7d13866
Handle certain key sequences better.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 13 Dec 2008 11:19:19 +0200 |
parents | abbdd101b267 |
children | 745f670068dc |
comparison
equal
deleted
inserted
replaced
76:162951c382b8 | 77:e8c9d7d13866 |
---|---|
617 int histPos = 0, histMax = 0; | 617 int histPos = 0, histMax = 0; |
618 | 618 |
619 memset(histBuf, 0, sizeof(histBuf)); | 619 memset(histBuf, 0, sizeof(histBuf)); |
620 | 620 |
621 /* Initialize */ | 621 /* Initialize */ |
622 th_init("NNChat", "Newbie Nudes chat client", "0.6.5", | 622 th_init("NNChat", "Newbie Nudes chat client", "0.6.6", |
623 "Written and designed by Anonymous Finnish Guy (C) 2008", | 623 "Written and designed by Anonymous Finnish Guy (C) 2008", |
624 "This software is freeware, use and distribute as you wish."); | 624 "This software is freeware, use and distribute as you wish."); |
625 th_verbosityLevel = 0; | 625 th_verbosityLevel = 0; |
626 | 626 |
627 /* Parse arguments */ | 627 /* Parse arguments */ |
812 BOOL update = FALSE; | 812 BOOL update = FALSE; |
813 | 813 |
814 /* Handle several buffered keypresses at once */ | 814 /* Handle several buffered keypresses at once */ |
815 do { | 815 do { |
816 c = wgetch(stdscr); | 816 c = wgetch(stdscr); |
817 | |
818 if (c == 0x1b) { | |
819 c = wgetch(stdscr); | |
820 if (c == 'O') { | |
821 c = wgetch(stdscr); | |
822 switch (c) { | |
823 case 'd': c = 0x204; break; | |
824 case 'c': c = 0x206; break; | |
825 default: | |
826 printMsg("Unhandled ESC-O key sequence 0x%02x\n", c); | |
827 break; | |
828 } | |
829 } else { | |
830 printMsg("Unhandled ESC key sequence 0x%02x\n", c); | |
831 continue; | |
832 } | |
833 } | |
834 | |
817 switch (c) { | 835 switch (c) { |
818 #ifdef KEY_RESIZE | 836 #ifdef KEY_RESIZE |
819 case KEY_RESIZE: | 837 case KEY_RESIZE: |
820 if (!initializeWindows()) { | 838 if (!initializeWindows()) { |
821 THERR("Error resizing ncurses windows\n"); | 839 THERR("Error resizing ncurses windows\n"); |
955 else | 973 else |
956 writeBuf(editBuf, editBuf->pos, c); | 974 writeBuf(editBuf, editBuf->pos, c); |
957 setBufPos(editBuf, editBuf->pos + 1); | 975 setBufPos(editBuf, editBuf->pos + 1); |
958 update = TRUE; | 976 update = TRUE; |
959 } else { | 977 } else { |
960 printMsg("Unhandled key: %02x\n", c); | 978 printMsg("Unhandled key: 0x%02x\n", c); |
961 } | 979 } |
962 break; | 980 break; |
963 } | 981 } |
964 } while (c != ERR && !exitProg && ++cnt < 10); | 982 } while (c != ERR && !exitProg && ++cnt < 10); |
965 | 983 |