summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-13 15:47:16 -0300
committerGitHub <noreply@github.com>2016-06-13 15:47:16 -0300
commit3cee648144b25a7d0ab1daa5ce09716958148f10 (patch)
treedf4e83b20236bfb4ba1a9a6506b6577b49b829a0 /tools
parentdca382647ee2734ff856f0aa50df12f86509c4e8 (diff)
parent9a2d5fa1e19acdeaaf9fef253571677868ad3346 (diff)
Merge pull request #5160 from neikeq/pr-issue-5136
FindReplaceBar: Fix search bug when text is selected
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/code_editor.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index d023827a3c..be5d9c47ff 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -247,8 +247,18 @@ void FindReplaceBar::_get_search_from(int& r_line, int& r_col) {
r_col=text_edit->cursor_get_column();
if (text_edit->is_selection_active() && !replace_all_mode) {
- r_line=text_edit->get_selection_from_line();
- r_col=text_edit->get_selection_to_column();
+
+ int selection_line=text_edit->get_selection_from_line();
+
+ if (text_edit->get_selection_text()==get_search_text() && r_line==selection_line) {
+
+ int selection_from_col=text_edit->get_selection_from_column();
+
+ if (r_col>=selection_from_col && r_col<=text_edit->get_selection_to_column()) {
+ r_col=selection_line;
+ r_col=selection_from_col;
+ }
+ }
}
if (r_line==result_line && r_col>=result_col && r_col<=result_col+get_search_text().length()) {