Fixes single line delete
This commit is contained in:
parent
01e0f008d4
commit
91476f21d5
13
hermes.c
13
hermes.c
|
@ -1348,6 +1348,18 @@ void editorCommandKp(int c) {
|
|||
} else if (!deleting) {
|
||||
deleting++;
|
||||
return;
|
||||
} else {
|
||||
if (counter <= 1) {
|
||||
int sz = E.row[E.cy].size + 1;
|
||||
char *buf = malloc(sz);
|
||||
strcpy(buf, E.row[E.cy].chars);
|
||||
buf[sz - 1] = '\r';
|
||||
editorUpdatePaste(buf, sz);
|
||||
free(buf);
|
||||
editorDelRow(E.cy);
|
||||
if (E.cy == E.numRows) E.cy--;
|
||||
if (E.cy < 0) E.cy = 0;
|
||||
if (E.cx >= E.row[E.cy].size) E.cx = 0;
|
||||
} else {
|
||||
int start_x = E.cx;
|
||||
int start_y = E.cy;
|
||||
|
@ -1364,6 +1376,7 @@ void editorCommandKp(int c) {
|
|||
}
|
||||
E.cx = start_x;
|
||||
if (E.cx >= E.row[E.cy].size) E.cx = E.row[E.cy].size - 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '$':
|
||||
|
|
Loading…
Reference in New Issue