Solved an issue while cutting and pasting.

This commit is contained in:
GrenderG committed 2017-04-11 01:24:12 +02:00
1 parent 14b57b50ff
commit 9be24d0732
1 file changed
+4 -3
+4 -3
View File
@@ -53,7 +53,7 @@
// Length of a tab stop // Length of a tab stop
#define TTE_TAB_STOP 4 #define TTE_TAB_STOP 4
// Times to press Ctrl-Q before exiting // Times to press Ctrl-Q before exiting
#define TTE_QUIT_TIMES 1 #define TTE_QUIT_TIMES 2
// Highlight flags // Highlight flags
#define HL_HIGHLIGHT_NUMBERS (1 << 0) #define HL_HIGHLIGHT_NUMBERS (1 << 0)
#define HL_HIGHLIGHT_STRINGS (1 << 1) #define HL_HIGHLIGHT_STRINGS (1 << 1)
@@ -912,6 +912,7 @@ void editorCopy(int cut) {
void editorCut() { void editorCut() {
editorCopy(-1); editorCopy(-1);
editorDelRow(ec.cursor_y); editorDelRow(ec.cursor_y);
ec.cursor_x = ec.row[ec.cursor_y].size - (ec.cursor_y == ec.num_rows);
} }
void editorPaste() { void editorPaste() {
@@ -1520,13 +1521,13 @@ void editorProcessKeypress() {
break; break;
case CTRL_KEY('q'): case CTRL_KEY('q'):
if (ec.dirty && quit_times > 0) { if (ec.dirty && quit_times > 0) {
editorSetStatusMessage("Warning! File has unsaved changes. Press Ctrl-Q again to quit"); editorSetStatusMessage("Warning! File has unsaved changes. Press Ctrl-Q %d more time to quit", quit_times);
quit_times--; quit_times--;
return; return;
} }
editorClearScreen(); editorClearScreen();
consoleBufferClose(); consoleBufferClose();
exit(0); exit(0);
break; break;
case CTRL_KEY('s'): case CTRL_KEY('s'):
editorSave(); editorSave();