src/input.c

changeset 38
75ee459ba941
parent 35
6c64b7a073af
child 39
4d3d398ba689
equal deleted inserted replaced
37:bcf624518909 38:75ee459ba941
56 str[*pos] = '\0'; 56 str[*pos] = '\0';
57 *pos = 0; 57 *pos = 0;
58 return 1; 58 return 1;
59 case KEY_BACKSPACE: 59 case KEY_BACKSPACE:
60 case KEY_LEFT: 60 case KEY_LEFT:
61 str[--(*pos)] = '\0'; 61 if ((*pos) > 0) {
62 str[--(*pos)] = '\0';
63 }
62 break; 64 break;
63 default: 65 default:
64 if (isprint(c) && *pos < len-1) { 66 if (isprint(c) && *pos < len-1) {
65 str[(*pos)++] = (char) c; 67 str[(*pos)++] = (char) c;
66 } 68 }

mercurial