summaryrefslogtreecommitdiff
path: root/tools/editor/code_editor.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-09-21 01:43:42 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-09-21 01:43:42 -0300
commit11a5ed508b1cbde61a4d9dd4f469e86e74667623 (patch)
treee4bc1926057d788aeeef3633930bb958eb976d3a /tools/editor/code_editor.cpp
parentc5b905fca82f1437486f2168270c5caa0b4bf104 (diff)
Fixed too many little issues, check the issues closed today.
Diffstat (limited to 'tools/editor/code_editor.cpp')
-rw-r--r--tools/editor/code_editor.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index 281415e4b7..6de59f184a 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -246,14 +246,28 @@ bool FindReplaceDialog::_search() {
if (is_backwards())
flags|=TextEdit::SEARCH_BACKWARDS;
- int line,col;
- bool found = text_edit->search(text,flags,text_edit->cursor_get_line(),text_edit->cursor_get_column(),line,col);
+ int line=text_edit->cursor_get_line(),col=text_edit->cursor_get_column();
+
+ if (is_backwards()) {
+ col-=1;
+ if (col<0) {
+ line-=1;
+ if (line<0) {
+ line=text_edit->get_line_count()-1;
+ }
+ col=text_edit->get_line(line).length();
+ }
+ }
+ bool found = text_edit->search(text,flags,line,col,line,col);
if (found) {
// print_line("found");
text_edit->cursor_set_line(line);
- text_edit->cursor_set_column(col+text.length());
+ if (is_backwards())
+ text_edit->cursor_set_column(col);
+ else
+ text_edit->cursor_set_column(col+text.length());
text_edit->select(line,col,line,col+text.length());
set_error("");
return true;