diff options
author | Michael Davis | 2022-11-06 14:56:45 +0000 |
---|---|---|
committer | GitHub | 2022-11-06 14:56:45 +0000 |
commit | 48a3965ab43718ce2a49724cbcc294b04c328b81 (patch) | |
tree | f20b4c26a8edc0d096bdd570df3c9cd1f3c0f172 /helix-term/tests | |
parent | 4ec2a21c6e21ab4e515f1bd7ee1049094af2a6b2 (diff) |
Fix range offsets in multi-selection paste (#4608)
* Fix range offsets in multi-selection paste
d6323b7cbc21a9d3ba29738c76581dad93f9f415 introduced a regression with
multi-selection paste where pasting would not adjust the ranges
correctly. To fix it, we need to track the total number of characters
inserted in each changed selection and use that offset to slide each
new range forwards.
* Inherit selection directions on paste
* Add an integration-test for multi-selection pasting
Diffstat (limited to 'helix-term/tests')
-rw-r--r-- | helix-term/tests/test/commands.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index aadf104b..e78e6c9f 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -193,3 +193,25 @@ async fn test_goto_file_impl() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn test_multi_selection_paste() -> anyhow::Result<()> { + test(( + platform_line(indoc! {"\ + #[|lorem]# + #(|ipsum)# + #(|dolor)# + "}) + .as_str(), + "yp", + platform_line(indoc! {"\ + lorem#[|lorem]# + ipsum#(|ipsum)# + dolor#(|dolor)# + "}) + .as_str(), + )) + .await?; + + Ok(()) +} |