aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorSkyler Hawthorne2022-05-10 03:08:12 +0000
committerSkyler Hawthorne2022-10-19 02:31:38 +0000
commite1f7bdb1d2ef68c0de38e768080291901ff4662e (patch)
tree8364a4965296f762e338f3803d8e99252eb62ae4 /helix-term
parent83b6042b97d13fca751e3d5d0c32f04e3ad04c9a (diff)
fix buffer-close
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs1
-rw-r--r--helix-term/src/commands/typed.rs6
-rw-r--r--helix-term/tests/test/commands.rs2
-rw-r--r--helix-term/tests/test/helpers.rs6
-rw-r--r--helix-term/tests/test/write.rs2
5 files changed, 10 insertions, 7 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 0640de3c..5c25e8aa 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -344,6 +344,7 @@ impl Application {
#[cfg(feature = "integration")]
{
+ log::debug!("idle handled");
idle_handled = true;
}
}
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 35c84601..efe693b9 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -77,9 +77,9 @@ fn buffer_close_by_ids_impl(
let (modified_ids, modified_names): (Vec<_>, Vec<_>) = doc_ids
.iter()
.filter_map(|&doc_id| {
- if let Err(CloseError::BufferModified(name)) =
+ if let Err(CloseError::BufferModified(name)) = tokio::task::block_in_place(|| {
helix_lsp::block_on(editor.close_document(doc_id, force))
- {
+ }) {
Some((doc_id, name))
} else {
None
@@ -151,7 +151,6 @@ fn buffer_close(
}
let document_ids = buffer_gather_paths_impl(cx.editor, args);
- log::debug!("closing buffers: {:?}", document_ids);
buffer_close_by_ids_impl(cx.editor, &document_ids, false)
}
@@ -519,6 +518,7 @@ fn write_quit(
}
write_impl(cx, args.first(), false)?;
+ // TODO: change to use document close
helix_lsp::block_on(cx.jobs.finish())?;
quit(cx, &[], event)
}
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs
index 8aea144b..1f1bd6a9 100644
--- a/helix-term/tests/test/commands.rs
+++ b/helix-term/tests/test/commands.rs
@@ -25,7 +25,7 @@ async fn test_write_quit_fail() -> anyhow::Result<()> {
Ok(())
}
-#[tokio::test]
+#[tokio::test(flavor = "multi_thread")]
async fn test_buffer_close_concurrent() -> anyhow::Result<()> {
test_key_sequences(
&mut Application::new(Args::default(), Config::default())?,
diff --git a/helix-term/tests/test/helpers.rs b/helix-term/tests/test/helpers.rs
index 8f2501e6..bbcc6632 100644
--- a/helix-term/tests/test/helpers.rs
+++ b/helix-term/tests/test/helpers.rs
@@ -56,7 +56,9 @@ pub async fn test_key_sequences(
for (i, (in_keys, test_fn)) in inputs.into_iter().enumerate() {
if let Some(in_keys) = in_keys {
for key_event in parse_macro(in_keys)?.into_iter() {
- tx.send(Ok(Event::Key(KeyEvent::from(key_event))))?;
+ let key = Event::Key(KeyEvent::from(key_event));
+ log::trace!("sending key: {:?}", key);
+ tx.send(Ok(key))?;
}
}
@@ -70,7 +72,7 @@ pub async fn test_key_sequences(
// verify if it exited on the last iteration if it should have and
// the inverse
if i == num_inputs - 1 && app_exited != should_exit {
- bail!("expected app to exit: {} != {}", app_exited, should_exit);
+ bail!("expected app to exit: {} != {}", should_exit, app_exited);
}
if let Some(test) = test_fn {
diff --git a/helix-term/tests/test/write.rs b/helix-term/tests/test/write.rs
index d2e6922f..544f1ba1 100644
--- a/helix-term/tests/test/write.rs
+++ b/helix-term/tests/test/write.rs
@@ -61,7 +61,7 @@ async fn test_write_quit() -> anyhow::Result<()> {
Ok(())
}
-#[tokio::test]
+#[tokio::test(flavor = "multi_thread")]
async fn test_write_concurrent() -> anyhow::Result<()> {
let mut file = tempfile::NamedTempFile::new()?;
let mut command = String::new();