Got visual highlighting working
This commit is contained in:
parent
9fb3904c05
commit
dfcceadd04
9
hermes.c
9
hermes.c
|
@ -697,6 +697,11 @@ void editorDrawRows(struct abuf *ab) {
|
||||||
char *c = &E.row[filerow].render[E.coloff];
|
char *c = &E.row[filerow].render[E.coloff];
|
||||||
unsigned char *hl = &E.row[filerow].hl[E.coloff];
|
unsigned char *hl = &E.row[filerow].hl[E.coloff];
|
||||||
int current_color = -1;
|
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;
|
int j;
|
||||||
for (j = 0; j < len; j++) {
|
for (j = 0; j < len; j++) {
|
||||||
if (iscntrl(c[j])) {
|
if (iscntrl(c[j])) {
|
||||||
|
@ -968,16 +973,18 @@ void editorMoveCursor(int key) {
|
||||||
if (E.cy < E.numRows) {
|
if (E.cy < E.numRows) {
|
||||||
E.cy++;
|
E.cy++;
|
||||||
}
|
}
|
||||||
|
if (sizeof(row) > 0 && E.cx < 0) E.cx = 0;
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
case ARROW_UP:
|
case ARROW_UP:
|
||||||
if (E.cy != 0) {
|
if (E.cy != 0) {
|
||||||
E.cy--;
|
E.cy--;
|
||||||
}
|
}
|
||||||
|
if (sizeof(row) > 0 && E.cx < 0) E.cx = 0;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
case ARROW_LEFT:
|
case ARROW_LEFT:
|
||||||
if (E.cx != 0) {
|
if (E.cx > 0) {
|
||||||
E.cx--;
|
E.cx--;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue