support vim replace command with range (#10709)
Release Notes: - Added support for line ranges in vim replace commands #9428 - not supporting anything other than bare line numbers right now - ~need to figure out how to show range in question in search bar~ @ConradIrwin implemented showing a highlight of the selected range for a short direction instead - ~tests lol~
This commit is contained in:
parent
0697b417a0
commit
bc736265be
6 changed files with 160 additions and 12 deletions
|
@ -278,6 +278,8 @@ pub fn init(cx: &mut AppContext) {
|
|||
});
|
||||
}
|
||||
|
||||
pub struct SearchWithinRange;
|
||||
|
||||
trait InvalidationRegion {
|
||||
fn ranges(&self) -> &[Range<Anchor>];
|
||||
}
|
||||
|
@ -9264,6 +9266,18 @@ impl Editor {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn set_search_within_ranges(
|
||||
&mut self,
|
||||
ranges: &[Range<Anchor>],
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
self.highlight_background::<SearchWithinRange>(
|
||||
ranges,
|
||||
|colors| colors.editor_document_highlight_read_background,
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn highlight_background<T: 'static>(
|
||||
&mut self,
|
||||
ranges: &[Range<Anchor>],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue