Allow right scrolling till end of line.

Allow scrolling right till one char past the
end of line.
This commit is contained in:
Saumya Bhatnagar 2018-05-29 00:46:05 +05:30
parent 29391fd723
commit 0cf62fb7af
2 changed files with 6 additions and 2 deletions

BIN
editor

Binary file not shown.

View File

@ -311,6 +311,8 @@ void editorRefreshTerminal() {
/*** input ***/
void editorMoveCursor(int c) {
editorrow *erow = E.cursorY < E.numrows ? &E.erow[E.cursorY] : NULL;
switch(c) {
case ARROW_LEFT:
if (E.cursorX != 0) {
@ -318,12 +320,14 @@ void editorMoveCursor(int c) {
}
break;
case ARROW_DOWN:
if (E.cursorY < E.numrows) { // allow scroll till end of file
if (E.cursorY < E.numrows) { // allow scroll till one line past end of file
E.cursorY++;
}
break;
case ARROW_RIGHT:
E.cursorX++;
if (erow && E.cursorX < erow->length) { // allow scroll till one char past end of line
E.cursorX++;
}
break;
case ARROW_UP:
if (E.cursorY != 0) {