Implement regex search with multiline support

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2022-01-28 16:15:18 +01:00
co-authored by Nathan Sobo
parent 5c862bfe98
commit 5b9d791269
7 changed files with 138 additions and 62 deletions
+3 -2
View File
@@ -29,10 +29,11 @@ use language::{
AnchorRangeExt as _, BracketPair, Buffer, Diagnostic, DiagnosticSeverity, Language, Point,
Selection, SelectionGoal, TransactionId,
};
use multi_buffer::MultiBufferChunks;
pub use multi_buffer::{
Anchor, AnchorRangeExt, ExcerptId, ExcerptProperties, MultiBuffer, ToOffset, ToPoint,
Anchor, AnchorRangeExt, ExcerptId, ExcerptProperties, MultiBuffer, MultiBufferSnapshot,
ToOffset, ToPoint,
};
use multi_buffer::{MultiBufferChunks, MultiBufferSnapshot};
use postage::watch;
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
+6 -3
View File
@@ -323,6 +323,7 @@ impl EditorElement {
end_row,
*color,
0.,
0.15 * layout.line_height,
layout,
content_origin,
scroll_top,
@@ -344,6 +345,7 @@ impl EditorElement {
end_row,
style.selection,
corner_radius,
corner_radius * 2.,
layout,
content_origin,
scroll_top,
@@ -400,6 +402,7 @@ impl EditorElement {
end_row: u32,
color: Color,
corner_radius: f32,
line_end_overshoot: f32,
layout: &LayoutState,
content_origin: Vector2F,
scroll_top: f32,
@@ -414,7 +417,7 @@ impl EditorElement {
cmp::max(range.start.row(), start_row)..cmp::min(range.end.row() + 1, end_row)
};
let selection = HighlightedRange {
let highlighted_range = HighlightedRange {
color,
line_height: layout.line_height,
corner_radius,
@@ -437,7 +440,7 @@ impl EditorElement {
+ line_layout.x_for_index(range.end.column() as usize)
- scroll_left
} else {
content_origin.x() + line_layout.width() + corner_radius * 2.0
content_origin.x() + line_layout.width() + line_end_overshoot
- scroll_left
},
}
@@ -445,7 +448,7 @@ impl EditorElement {
.collect(),
};
selection.paint(bounds, cx.scene);
highlighted_range.paint(bounds, cx.scene);
}
}