Now syntax highlighting is updating correctly when flipping lines.
This commit is contained in:
1 parent
d48f31f4ef
commit
a4e6b533c6
1 file changed
+19
-10
@@ -49,7 +49,7 @@
|
|||||||
// Empty buffer
|
// Empty buffer
|
||||||
#define ABUF_INIT {NULL, 0}
|
#define ABUF_INIT {NULL, 0}
|
||||||
// Version code
|
// Version code
|
||||||
#define TTE_VERSION "0.0.1"
|
#define TTE_VERSION "0.0.2"
|
||||||
// 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
|
||||||
@@ -865,15 +865,6 @@ void editorFreeRow(editor_row* row) {
|
|||||||
free(row -> highlight);
|
free(row -> highlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -1 down, 1 up
|
|
||||||
void editorFlipRow(int dir) {
|
|
||||||
editor_row c_row = ec.row[ec.cursor_y];
|
|
||||||
ec.row[ec.cursor_y] = ec.row[ec.cursor_y - dir];
|
|
||||||
ec.row[ec.cursor_y - dir] = c_row;
|
|
||||||
ec.cursor_y -= dir;
|
|
||||||
ec.dirty++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void editorDelRow(int at) {
|
void editorDelRow(int at) {
|
||||||
if (at < 0 || at >= ec.num_rows)
|
if (at < 0 || at >= ec.num_rows)
|
||||||
return;
|
return;
|
||||||
@@ -888,6 +879,24 @@ void editorDelRow(int at) {
|
|||||||
ec.dirty++;
|
ec.dirty++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -1 down, 1 up
|
||||||
|
void editorFlipRow(int dir) {
|
||||||
|
editor_row c_row = ec.row[ec.cursor_y];
|
||||||
|
ec.row[ec.cursor_y] = ec.row[ec.cursor_y - dir];
|
||||||
|
ec.row[ec.cursor_y - dir] = c_row;
|
||||||
|
|
||||||
|
ec.row[ec.cursor_y].idx += dir;
|
||||||
|
ec.row[ec.cursor_y - dir].idx -= dir;
|
||||||
|
|
||||||
|
int first = (dir == 1) ? ec.cursor_y - 1 : ec.cursor_y;
|
||||||
|
editorUpdateSyntax(&ec.row[first]);
|
||||||
|
editorUpdateSyntax(&ec.row[first] + 1);
|
||||||
|
editorUpdateSyntax(&ec.row[first] + 2);
|
||||||
|
|
||||||
|
ec.cursor_y -= dir;
|
||||||
|
ec.dirty++;
|
||||||
|
}
|
||||||
|
|
||||||
void editorRowInsertChar(editor_row* row, int at, int c) {
|
void editorRowInsertChar(editor_row* row, int at, int c) {
|
||||||
if (at < 0 || at > row -> size)
|
if (at < 0 || at > row -> size)
|
||||||
at = row -> size;
|
at = row -> size;
|
||||||
|
|||||||
Reference in new issue
Block a user