From 11a5ed508b1cbde61a4d9dd4f469e86e74667623 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 21 Sep 2014 01:43:42 -0300 Subject: Fixed too many little issues, check the issues closed today. --- tools/editor/code_editor.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'tools/editor/code_editor.cpp') 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; -- cgit v1.2.3