Got visual highlighting working

This commit is contained in:
sloumdrone 2020-01-02 18:01:09 -08:00
parent 9fb3904c05
commit dfcceadd04
1 changed files with 8 additions and 1 deletions

View File

@ -697,6 +697,11 @@ void editorDrawRows(struct abuf *ab) {
char *c = &E.row[filerow].render[E.coloff];
unsigned char *hl = &E.row[filerow].hl[E.coloff];
int current_color = -1;
if (E.mode == VisualMode && len <= 0 && filerow == E.cy) {
char vbuf[16];
int vclen = snprintf(vbuf, sizeof(vbuf), "\033[48;5;%dm", EDITOR_BG_COLOR);
abAppend(ab, vbuf, vclen);
}
int j;
for (j = 0; j < len; j++) {
if (iscntrl(c[j])) {
@ -968,16 +973,18 @@ void editorMoveCursor(int key) {
if (E.cy < E.numRows) {
E.cy++;
}
if (sizeof(row) > 0 && E.cx < 0) E.cx = 0;
break;
case 'k':
case ARROW_UP:
if (E.cy != 0) {
E.cy--;
}
if (sizeof(row) > 0 && E.cx < 0) E.cx = 0;
break;
case 'h':
case ARROW_LEFT:
if (E.cx != 0) {
if (E.cx > 0) {
E.cx--;
}
break;