Compare commits
No commits in common. "8541312ec01c1660058021f8a56443ac0be87628" and "a92c9cd07a75c45271adcf6fedaba47adb1bb189" have entirely different histories.
8541312ec0
...
a92c9cd07a
2 changed files with 6 additions and 39 deletions
10
config.h
10
config.h
|
@ -46,17 +46,11 @@ enum keys {
|
||||||
PAGE_DOWN
|
PAGE_DOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
enum actions {
|
|
||||||
COUNTING = 500,
|
|
||||||
DELETE
|
|
||||||
};
|
|
||||||
|
|
||||||
enum modes {
|
enum modes {
|
||||||
NORMAL,
|
NORMAL,
|
||||||
INSERT,
|
INSERT,
|
||||||
VISUAL,
|
VISUAL,
|
||||||
COMMAND,
|
COMMAND
|
||||||
PENDING0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum highlight {
|
enum highlight {
|
||||||
|
@ -127,4 +121,4 @@ language_t langs[] = {
|
||||||
#define LANGS_LEN (sizeof(langs) / sizeof(langs[0]))
|
#define LANGS_LEN (sizeof(langs) / sizeof(langs[0]))
|
||||||
|
|
||||||
#define CTRL_KEY(k) ((k) & 0x1f)
|
#define CTRL_KEY(k) ((k) & 0x1f)
|
||||||
#define MAX_COMMAND_SIZE 512
|
#define COLOR_LEN 19
|
||||||
|
|
31
vip.c
31
vip.c
|
@ -23,9 +23,6 @@ int rows, cols;
|
||||||
editor_t editor[9];
|
editor_t editor[9];
|
||||||
int editors = 0;
|
int editors = 0;
|
||||||
editor_t *cur_editor;
|
editor_t *cur_editor;
|
||||||
int action = DEFAULT;
|
|
||||||
char cmd[MAX_COMMAND_SIZE];
|
|
||||||
int cmd_len = 0;
|
|
||||||
|
|
||||||
void draw_status_bar(void);
|
void draw_status_bar(void);
|
||||||
void refresh_screen(void);
|
void refresh_screen(void);
|
||||||
|
@ -185,8 +182,8 @@ void refresh_screen(void)
|
||||||
draw_rows();
|
draw_rows();
|
||||||
if (!cat_mode) {
|
if (!cat_mode) {
|
||||||
draw_status_bar();
|
draw_status_bar();
|
||||||
move_cursor(cur_editor->y - cur_editor->rowoff + 1,
|
move_cursor((cur_editor->y - cur_editor->rowoff) + 1,
|
||||||
cur_editor->rx - cur_editor->coloff + 1 + 7);
|
(cur_editor->rx - cur_editor->coloff) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,16 +1076,6 @@ int main(int argc, char **argv)
|
||||||
insert_new_line();
|
insert_new_line();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '1': case '2': case '3': case '4': case '5': case '6': case '7':
|
|
||||||
case '8': case '9':
|
|
||||||
action = COUNTING;
|
|
||||||
cmd[cmd_len++] = c;
|
|
||||||
cmd[cmd_len] = '\0';
|
|
||||||
/* cmd occupy 10 char and add a trailing space*/
|
|
||||||
int lpadding = cols - 11;
|
|
||||||
wpprintw("%*s%-10s ", lpadding, "", cmd);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HOME_KEY:
|
case HOME_KEY:
|
||||||
cur_editor->x = 0;
|
cur_editor->x = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1224,16 +1211,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
case 'j': /* PASSTHROUGH */
|
case 'j': /* PASSTHROUGH */
|
||||||
if (cur_editor->mode != INSERT) {
|
if (cur_editor->mode != INSERT) {
|
||||||
if (action == COUNTING) {
|
|
||||||
for (int i = 0; i < atoi(cmd); i++) {
|
|
||||||
move_xy(ARROW_DOWN);
|
move_xy(ARROW_DOWN);
|
||||||
}
|
|
||||||
action = DEFAULT;
|
|
||||||
cmd_len = 0;
|
|
||||||
memset(&cmd, 0, MAX_COMMAND_SIZE);
|
|
||||||
} else {
|
|
||||||
move_xy(ARROW_DOWN);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1265,12 +1243,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
case '0': /* PASSTHROUGH */
|
case '0': /* PASSTHROUGH */
|
||||||
if (cur_editor->mode == NORMAL) {
|
if (cur_editor->mode == NORMAL) {
|
||||||
if (cmd_len == 0) {
|
|
||||||
cur_editor->x = 0;
|
cur_editor->x = 0;
|
||||||
} else {
|
|
||||||
action = COUNTING;
|
|
||||||
cmd[cmd_len++] = c;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue