mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 02:37:21 +00:00
Allow a new search to be created with cmd-enter
This replaces the `cmd-alt-shift-F` binding to open a new search. Instead, you can preserve the existing search results by entering a query and then hitting `cmd-enter` instead of `enter`. This opens a new project find view and restores the previous view to whatever query it was previously displaying. It's a bit strange, but I don't want to rely on splitting as the only way of creating multiple sets of search results.
This commit is contained in:
parent
ae1a46a4e4
commit
2f427769df
3 changed files with 578 additions and 514 deletions
|
@ -5144,6 +5144,14 @@ impl Editor {
|
|||
self.buffer.read(cx).read(cx).text()
|
||||
}
|
||||
|
||||
pub fn set_text(&mut self, text: impl Into<String>, cx: &mut ViewContext<Self>) {
|
||||
self.buffer
|
||||
.read(cx)
|
||||
.as_singleton()
|
||||
.expect("you can only call set_text on editors for singleton buffers")
|
||||
.update(cx, |buffer, cx| buffer.set_text(text, cx));
|
||||
}
|
||||
|
||||
pub fn display_text(&self, cx: &mut MutableAppContext) -> String {
|
||||
self.display_map
|
||||
.update(cx, |map, cx| map.snapshot(cx))
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1345,6 +1345,13 @@ impl Buffer {
|
|||
let _ = language_server.latest_snapshot.blocking_send(snapshot);
|
||||
}
|
||||
|
||||
pub fn set_text<T>(&mut self, text: T, cx: &mut ModelContext<Self>) -> Option<clock::Local>
|
||||
where
|
||||
T: Into<String>,
|
||||
{
|
||||
self.edit_internal([0..self.len()], text, false, cx)
|
||||
}
|
||||
|
||||
pub fn edit<I, S, T>(
|
||||
&mut self,
|
||||
ranges_iter: I,
|
||||
|
|
Loading…
Reference in a new issue