Make search context larger (#10289)
This increases search context from 1 above, 2 below, to 2 above and 2 below, matching the Sublime Text search results. Release Notes: - Increased search result context from 3 lines to 4 lines
This commit is contained in:
parent
44aed4a0cb
commit
d2bf80ca3d
2 changed files with 12 additions and 5 deletions
|
@ -55,6 +55,8 @@ struct ActiveSettings(HashMap<WeakModel<Project>, ProjectSearchSettings>);
|
|||
|
||||
impl Global for ActiveSettings {}
|
||||
|
||||
const SEARCH_CONTEXT: u32 = 2;
|
||||
|
||||
pub fn init(cx: &mut AppContext) {
|
||||
cx.set_global(ActiveSettings::default());
|
||||
cx.observe_new_views(|workspace: &mut Workspace, _cx| {
|
||||
|
@ -235,8 +237,12 @@ impl ProjectSearch {
|
|||
.update(&mut cx, |this, cx| {
|
||||
this.no_results = Some(false);
|
||||
this.excerpts.update(cx, |excerpts, cx| {
|
||||
excerpts
|
||||
.stream_excerpts_with_context_lines(buffer, ranges, 1, cx)
|
||||
excerpts.stream_excerpts_with_context_lines(
|
||||
buffer,
|
||||
ranges,
|
||||
SEARCH_CONTEXT,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
})
|
||||
.ok()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue