debug find callback
This commit is contained in:
1 file changed
+4
-8
@@ -212,8 +212,7 @@ int editorRowRxToCx(erow *row, int rx) {
|
|||||||
int cur_rx = 0;
|
int cur_rx = 0;
|
||||||
int cx;
|
int cx;
|
||||||
for (cx = 0; cx < row->size; cx++) {
|
for (cx = 0; cx < row->size; cx++) {
|
||||||
if (row->chars[cx] == '\t')
|
if (row->chars[cx] == '\t') cur_rx += (LEVEL_TAB_STOP - 1) - (cur_rx % LEVEL_TAB_STOP);
|
||||||
cur_rx += (LEVEL_TAB_STOP - 1) - (cur_rx % LEVEL_TAB_STOP);
|
|
||||||
cur_rx++;
|
cur_rx++;
|
||||||
|
|
||||||
if (cur_rx > rx) return cx;
|
if (cur_rx > rx) return cx;
|
||||||
@@ -320,9 +319,8 @@ void editorInsertChar(int c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void editorInsertNewLine() {
|
void editorInsertNewLine() {
|
||||||
if (E.cx == 0) {
|
if (E.cx == 0) editorInsertRow(E.cy, "", 0);
|
||||||
editorInsertRow(E.cy, "", 0);
|
else {
|
||||||
} else {
|
|
||||||
erow *row = &E.row[E.cy];
|
erow *row = &E.row[E.cy];
|
||||||
editorInsertRow(E.cy + 1, &row->chars[E.cx], row->size - E.cx);
|
editorInsertRow(E.cy + 1, &row->chars[E.cx], row->size - E.cx);
|
||||||
row = &E.row[E.cy];
|
row = &E.row[E.cy];
|
||||||
@@ -427,7 +425,7 @@ void editorFindCallback(char *query, int key) {
|
|||||||
static int last_match = -1;
|
static int last_match = -1;
|
||||||
static int direction = 1;
|
static int direction = 1;
|
||||||
|
|
||||||
if (key == '\r' || key == '\x1b') {
|
if (key == '\r' || key == ESCAPE_CONST) {
|
||||||
last_match = -1;
|
last_match = -1;
|
||||||
direction = 1;
|
direction = 1;
|
||||||
return;
|
return;
|
||||||
@@ -455,8 +453,6 @@ void editorFindCallback(char *query, int key) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void editorFind() {
|
void editorFind() {
|
||||||
|
|||||||
Reference in new issue
Block a user