update_screen(¤t_line, &temporary_line, 0, nb_lines, lines, cursor_position, pattern);
+ // \000 ^@
+ // \001 ^A
+ // ...
+ // \032 ^Z
+ // \033 ^[
+ // \034 ^\
+ // \035 ^]
+ // \036 ^^
+ // \037 ^_
+ // \177 ^?
+
do {
key = getch();
pattern[cursor_position++] = key;
}
- else if(key == KEY_BACKSPACE || key == '\b' || key == '\7f') {
+ else if(key == KEY_BACKSPACE || key == '\010' || key == '\177') {
if(cursor_position > 0) {
if(pattern[cursor_position]) {
int c = cursor_position-1;
}
}
- else if(key == KEY_DC || key == '\ 4') {
+ else if(key == KEY_DC || key == '\004') {
if(pattern[cursor_position]) {
int c = cursor_position;
while(pattern[c]) {
motion = -10;
}
- else if(key == KEY_DOWN || key == '\ e') {
+ else if(key == KEY_DOWN || key == '\014') {
motion = 1;
}
- else if(key == KEY_UP || key == '\10') {
+ else if(key == KEY_UP || key == '\016') {
motion = -1;
}
- else if(key == KEY_LEFT || key == '\ 2') {
+ else if(key == KEY_LEFT || key == '\002') {
if(cursor_position > 0) cursor_position--;
}
- else if(key == KEY_RIGHT || key == '\ 6') {
+ else if(key == KEY_RIGHT || key == '\006') {
if(pattern[cursor_position]) cursor_position++;
}
- else if(key == '\ 1') {
+ else if(key == '\001') {
cursor_position = 0;
}
- else if(key == '\ 5') {
+ else if(key == '\005') {
cursor_position = strlen(pattern);
}
- else if(key == '\12') {
+ else if(key == '\022') {
use_regexp = !use_regexp;
}
- else if(key == '\15') {
+ else if(key == '\025') {
int s = 0;
while(pattern[cursor_position + s]) {
pattern[s] = pattern[cursor_position + s];
cursor_position = 0;
}
- else if(key == '\v') {
+ else if(key == '\013') {
pattern[cursor_position] = '\0';
}
update_screen(¤t_line, &temporary_line, motion,
nb_lines, lines, cursor_position, pattern);
- } while(key != '\n' && key != KEY_ENTER && key != '\a');
+ } while(key != '\n' && key != KEY_ENTER && key != '\007');
echo();
curs_set(1);