mirror of https://github.com/Sam1301/Lite.git
Restore cursor position when cancelling search
This commit is contained in:
parent
0a678b5400
commit
ea53b4c5c1
10
editor.c
10
editor.c
|
@ -479,10 +479,20 @@ void editorFindCallback(char* query, int cur_key) {
|
|||
}
|
||||
|
||||
void editorFind() {
|
||||
int saved_cursorX = E.cursorX;
|
||||
int saved_cursorY = E.cursorY;
|
||||
int saved_colOff = E.colOff;
|
||||
int saved_rowOff = E.rowOff;
|
||||
|
||||
char *query = editorPrompt("Search: %s (ESC to cancel)", editorFindCallback);
|
||||
|
||||
if (query) {
|
||||
free(query);
|
||||
} else {
|
||||
E.cursorX = saved_cursorX;
|
||||
E.cursorY = saved_cursorY;
|
||||
E.colOff = saved_colOff;
|
||||
E.rowOff = saved_rowOff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue