Skip autoclosed pairs

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-10-06 19:04:55 +02:00
parent 05d7e9c4e7
commit 724272931a
5 changed files with 174 additions and 58 deletions

View file

@ -1070,7 +1070,7 @@ impl WorkspaceHandle for ViewHandle<Workspace> {
#[cfg(test)]
mod tests {
use super::*;
use editor::{Editor, Insert};
use editor::{Editor, Input};
use serde_json::json;
use std::collections::HashSet;
@ -1282,7 +1282,7 @@ mod tests {
item.to_any().downcast::<Editor>().unwrap()
});
cx.update(|cx| editor.update(cx, |editor, cx| editor.insert(&Insert("x".into()), cx)));
cx.update(|cx| editor.update(cx, |editor, cx| editor.handle_input(&Input("x".into()), cx)));
fs.insert_file("/root/a.txt", "changed".to_string())
.await
.unwrap();
@ -1335,7 +1335,7 @@ mod tests {
assert!(!editor.is_dirty(cx.as_ref()));
assert_eq!(editor.title(cx.as_ref()), "untitled");
assert!(editor.language(cx).is_none());
editor.insert(&Insert("hi".into()), cx);
editor.handle_input(&Input("hi".into()), cx);
assert!(editor.is_dirty(cx.as_ref()));
});
@ -1367,7 +1367,7 @@ mod tests {
// Edit the file and save it again. This time, there is no filename prompt.
editor.update(&mut cx, |editor, cx| {
editor.insert(&Insert(" there".into()), cx);
editor.handle_input(&Input(" there".into()), cx);
assert_eq!(editor.is_dirty(cx.as_ref()), true);
});
workspace.update(&mut cx, |workspace, cx| {
@ -1428,7 +1428,7 @@ mod tests {
editor.update(&mut cx, |editor, cx| {
assert!(editor.language(cx).is_none());
editor.insert(&Insert("hi".into()), cx);
editor.handle_input(&Input("hi".into()), cx);
assert!(editor.is_dirty(cx.as_ref()));
});