Changeset 6071a8f in mainline
- Timestamp:
- 2009-04-07T19:03:18Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9eb3623
- Parents:
- 2845930
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/input.c
r2845930 r6071a8f 37 37 #include <kbd/kbd.h> 38 38 #include <kbd/keycode.h> 39 #include <errno.h> 40 #include <bool.h> 39 41 40 42 #include "config.h" … … 100 102 { 101 103 kbd_event_t ev; 102 int chars; 104 size_t offs, otmp; 105 wchar_t dec; 103 106 104 chars = 0;105 while ( chars < n - 1) {107 offs = 0; 108 while (true) { 106 109 fflush(stdout); 107 110 if (kbd_get_event(&ev) < 0) … … 113 116 break; 114 117 if (ev.key == KC_BACKSPACE) { 115 if (chars > 0) { 118 if (offs > 0) { 119 /* 120 * Back up until we reach valid start of 121 * character. 122 */ 123 while (offs > 0) { 124 --offs; otmp = offs; 125 dec = str_decode(buffer, &otmp, n); 126 if (dec != U_SPECIAL) 127 break; 128 } 116 129 putchar('\b'); 117 --chars;118 130 } 119 131 continue; … … 121 133 if (ev.c >= ' ') { 122 134 //putchar(ev.c); 123 console_putchar(ev.c);124 buffer[chars++] = ev.c;135 if (chr_encode(ev.c, buffer, &offs, n - 1) == EOK) 136 console_putchar(ev.c); 125 137 } 126 138 } 127 139 putchar('\n'); 128 buffer[ chars] = '\0';140 buffer[offs] = '\0'; 129 141 } 130 142
Note:
See TracChangeset
for help on using the changeset viewer.