forked from helix-editor/helix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trim all trailing whitespace on insert_newline
- Loading branch information
1 parent
4c8175c
commit 1e6fe00
Showing
4 changed files
with
78 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ use helix_term::application::Application; | |
|
||
use super::*; | ||
|
||
mod insert; | ||
mod movement; | ||
mod write; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use super::*; | ||
|
||
#[tokio::test(flavor = "multi_thread")] | ||
async fn insert_newline_trim_trailing_whitespace() -> anyhow::Result<()> { | ||
// Trailing whitespace is trimmed. | ||
test(( | ||
indoc! {"\ | ||
hello·······#[| | ||
]#world | ||
"} | ||
.replace('·', " "), | ||
"i<ret>", | ||
indoc! {"\ | ||
hello | ||
#[| | ||
]#world | ||
"} | ||
.replace('·', " "), | ||
)) | ||
.await?; | ||
|
||
// Whitespace that would become trailing is trimmed too. | ||
test(( | ||
indoc! {"\ | ||
hello········#[|w]#orld | ||
"} | ||
.replace('·', " "), | ||
"i<ret>", | ||
indoc! {"\ | ||
hello | ||
#[|w]#orld | ||
"} | ||
.replace('·', " "), | ||
)) | ||
.await?; | ||
|
||
// Only whitespace before the cursor is trimmed. | ||
test(( | ||
indoc! {"\ | ||
hello········#[|·]#····world | ||
"} | ||
.replace('·', " "), | ||
"i<ret>", | ||
indoc! {"\ | ||
hello | ||
#[|·]#····world | ||
"} | ||
.replace('·', " "), | ||
)) | ||
.await?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters