Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
e54031cf
Unverified
Commit
e54031cf
authored
Jun 18, 2020
by
Rémi Verschelde
Committed by
GitHub
Jun 18, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39614 from hinlopen/fix-search-highlight
Search result highlights follow font size
parents
a8fce16b
a86521d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
find_in_files.cpp
editor/find_in_files.cpp
+11
-11
find_in_files.h
editor/find_in_files.h
+1
-2
No files found.
editor/find_in_files.cpp
View file @
e54031cf
...
...
@@ -719,22 +719,20 @@ void FindInFilesPanel::_on_result_found(String fpath, int line_number, int begin
// Do this first because it resets properties of the cell...
item
->
set_cell_mode
(
text_index
,
TreeItem
::
CELL_MODE_CUSTOM
);
String
item_text
=
vformat
(
"%3s: %s"
,
line_number
,
text
.
replace
(
"
\t
"
,
" "
));
// Trim result item line
int
old_text_size
=
text
.
size
();
text
=
text
.
strip_edges
(
true
,
false
);
int
chars_removed
=
old_text_size
-
text
.
size
();
String
start
=
vformat
(
"%3s: "
,
line_number
);
item
->
set_text
(
text_index
,
item_
text
);
item
->
set_text
(
text_index
,
start
+
text
);
item
->
set_custom_draw
(
text_index
,
this
,
"_draw_result_text"
);
Ref
<
Font
>
font
=
_results_display
->
get_theme_font
(
"font"
);
float
raw_text_width
=
font
->
get_string_size
(
text
).
x
;
float
item_text_width
=
font
->
get_string_size
(
item_text
).
x
;
Result
r
;
r
.
line_number
=
line_number
;
r
.
begin
=
begin
;
r
.
end
=
end
;
r
.
draw_begin
=
(
item_text_width
-
raw_text_width
)
+
font
->
get_string_size
(
text
.
left
(
r
.
begin
)).
x
;
r
.
draw_width
=
font
->
get_string_size
(
text
.
substr
(
r
.
begin
,
r
.
end
-
r
.
begin
)).
x
;
r
.
begin_trimmed
=
begin
-
chars_removed
+
start
.
size
()
-
1
;
_result_items
[
item
]
=
r
;
if
(
_with_replace
)
{
...
...
@@ -755,10 +753,12 @@ void FindInFilesPanel::draw_result_text(Object *item_obj, Rect2 rect) {
return
;
}
Result
r
=
E
->
value
();
String
item_text
=
item
->
get_text
(
_with_replace
?
1
:
0
);
Ref
<
Font
>
font
=
_results_display
->
get_theme_font
(
"font"
);
Rect2
match_rect
=
rect
;
match_rect
.
position
.
x
+=
r
.
draw_begin
;
match_rect
.
size
.
x
=
r
.
draw_width
;
match_rect
.
position
.
x
+=
font
->
get_string_size
(
item_text
.
left
(
r
.
begin_trimmed
)).
x
;
match_rect
.
size
.
x
=
font
->
get_string_size
(
_search_text_label
->
get_text
()).
x
;
match_rect
.
position
.
y
+=
1
*
EDSCALE
;
match_rect
.
size
.
y
-=
2
*
EDSCALE
;
...
...
editor/find_in_files.h
View file @
e54031cf
...
...
@@ -191,8 +191,7 @@ private:
int
line_number
;
int
begin
;
int
end
;
float
draw_begin
;
float
draw_width
;
int
begin_trimmed
;
};
void
apply_replaces_in_file
(
String
fpath
,
const
Vector
<
Result
>
&
locations
,
String
new_text
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment