on master help sign in
Drop cx.view_id, it was used before we had cx.current.
commitfae2127a119b6aebcb87056d01de47e84be084ed authorBlaž Hrastnik <blaz@mxxn.io> dateSat 15 May 2021, 10:31 (5 years ago) parent0e5b421
2 files changed+6−7
helix-term/src/commands.rs+6−6 helix-term/src/ui/editor.rs−1
helix-term/src/commands.rs+6−6
@@ -37,7 +37,6 @@ use once_cell::sync::Lazy;
3737pub struct Context<'a> {
3838 pub count: usize,
3939 pub editor: &'a mut Editor,
40− pub view_id: ViewId,
4140
4241 pub callback: Option<crate::compositor::Callback>,
4342 pub on_next_key_callback: Option<Box<dyn FnOnce(&mut Context, KeyEvent)>>,
@@ -656,7 +655,7 @@ fn _search(doc: &mut Document, view: &mut View, contents: &str, regex: &Regex, e
656655
657656// TODO: use one function for search vs extend
658657pub fn search(cx: &mut Context) {
659− let doc = cx.doc();
658+ let (view, doc) = cx.current();
660659
661660 // TODO: could probably share with select_on_matches?
662661
@@ -664,7 +663,7 @@ pub fn search(cx: &mut Context) {
664663 // feed chunks into the regex yet
665664 let contents = doc.text().slice(..).to_string();
666665
667− let view_id = cx.view_id;
666+ let view_id = view.id;
668667 let prompt = ui::regex_prompt(cx, "search:".to_string(), move |view, doc, regex| {
669668 let text = doc.text();
670669 let start = doc.selection(view.id).cursor();
@@ -1739,12 +1738,12 @@ pub mod insert {
17391738// storing it?
17401739
17411740pub fn undo(cx: &mut Context) {
1742− let view_id = cx.view_id;
1741+ let view_id = cx.view().id;
17431742 cx.doc().undo(view_id);
17441743}
17451744
17461745pub fn redo(cx: &mut Context) {
1747− let view_id = cx.view_id;
1746+ let view_id = cx.view().id;
17481747 cx.doc().redo(view_id);
17491748}
17501749
@@ -2272,8 +2271,9 @@ pub fn space_mode(cx: &mut Context) {
22722271 tokio::spawn(doc.save());
22732272 }
22742273 'c' => {
2274+ let view_id = cx.view().id;
22752275 // close current split
2276− cx.editor.close(cx.view_id, /* close_buffer */ false);
2276+ cx.editor.close(view_id, /* close_buffer */ false);
22772277 }
22782278 // ' ' => toggle_alternate_buffer(cx),
22792279 // TODO: temporary since space mode took it's old key
helix-term/src/ui/editor.rs−1
@@ -530,7 +530,6 @@ impl Component for EditorView {
530530 let mode = doc.mode();
531531
532532 let mut cxt = commands::Context {
533− view_id: view.id,
534533 editor: &mut cx.editor,
535534 count: 1,
536535 callback: None,