Snap cursor to end of line

This commit is contained in:
Saumya Bhatnagar 2018-05-29 01:00:56 +05:30
parent 0cf62fb7af
commit 038cd5461d
2 changed files with 6 additions and 0 deletions

BIN
editor

Binary file not shown.

View File

@ -335,6 +335,12 @@ void editorMoveCursor(int c) {
}
break;
}
erow = E.cursorY < E.numrows ? &E.erow[E.cursorY] : NULL; // cursorY may be different, hence calculate again
int len = erow ? erow->length : 0;
if (E.cursorX > len) {
E.cursorX = len;
}
}
void editorProcessKey() {