Still buggy as hell

This commit is contained in:
sloumdrone 2020-01-02 22:35:04 -08:00
parent 4667adbf8c
commit c84afc7614
1 changed files with 6 additions and 6 deletions

View File

@ -1001,7 +1001,7 @@ void editorMoveCursor(int key) {
switch (key) {
case 'j':
case ARROW_DOWN:
if (E.cy < E.numRows) {
if (E.cy < E.numRows - 1) {
E.cy++;
}
if (sizeof(row) > 0 && E.cx < 0) E.cx = 0;
@ -1176,7 +1176,6 @@ void editorCommandKp(int c) {
}
break;
case 'o':
deleting = 0;
E.cx = E.row[E.cy].size;
E.mode = InputMode;
editorMoveCursor(ARROW_RIGHT);
@ -1184,9 +1183,10 @@ void editorCommandKp(int c) {
break;
case 'O':
E.cx = 0;
E.mode = InputMode;
editorInsertNewline();
editorMoveCursor(ARROW_UP);
E.mode = InputMode;
editorMoveCursor(ARROW_RIGHT);
break;
case 'x':
while (counter > 0) {
@ -1254,7 +1254,8 @@ void editorCommandKp(int c) {
int start_x = E.cx;
int start_y = E.cy;
editorNextWord();
editorUpdatePaste(&E.row[E.cy].chars[start_x], E.cx - start_x);
int len = start_y == E.cy ? E.cx - start_x : E.row[start_y].size - start_x;
editorUpdatePaste(&E.row[start_y].chars[start_x], len);
while (E.cy != start_y || E.cx != start_x) {
editorDeleteChar();
}
@ -1277,12 +1278,11 @@ void editorCommandKp(int c) {
E.mode = InputMode;
if (open == 'o') editorMoveCursor(ARROW_RIGHT);
}
for (int i = 0; i < E.pastelen; i++) {
editorInputKp(E.paste[i]);
}
if (multiline) {
editorInputKp(DEL_KEY);
editorInputKp(BACKSPACE);
E.cx = startx <= E.row[E.cy].size ? startx : E.row[E.cy].size;
}
E.mode = CommandMode;