Fix auto-indent when pasting multi-line content that was copied start… (#26246)
Closes https://github.com/zed-industries/zed/issues/24914 (again) Release Notes: - Fixed an issue where multi-line pasted content was auto-indented incorrectly if copied from the middle of an existing line.
This commit is contained in:
parent
f373383fc1
commit
be75f17429
8 changed files with 93 additions and 59 deletions
|
@ -1643,7 +1643,7 @@ fn test_autoindent_block_mode(cx: &mut App) {
|
|||
// indent level, but the indentation of the first line was not included in
|
||||
// the copied text. This information is retained in the
|
||||
// 'original_indent_columns' vector.
|
||||
let original_indent_columns = vec![4];
|
||||
let original_indent_columns = vec![Some(4)];
|
||||
let inserted_text = r#"
|
||||
"
|
||||
c
|
||||
|
@ -1658,7 +1658,7 @@ fn test_autoindent_block_mode(cx: &mut App) {
|
|||
buffer.edit(
|
||||
[(Point::new(2, 0)..Point::new(2, 0), inserted_text.clone())],
|
||||
Some(AutoindentMode::Block {
|
||||
original_start_columns: original_indent_columns.clone(),
|
||||
original_indent_columns: original_indent_columns.clone(),
|
||||
}),
|
||||
cx,
|
||||
);
|
||||
|
@ -1686,7 +1686,7 @@ fn test_autoindent_block_mode(cx: &mut App) {
|
|||
buffer.edit(
|
||||
[(Point::new(2, 8)..Point::new(2, 8), inserted_text)],
|
||||
Some(AutoindentMode::Block {
|
||||
original_start_columns: original_indent_columns.clone(),
|
||||
original_indent_columns: original_indent_columns.clone(),
|
||||
}),
|
||||
cx,
|
||||
);
|
||||
|
@ -1735,7 +1735,7 @@ fn test_autoindent_block_mode_without_original_indent_columns(cx: &mut App) {
|
|||
buffer.edit(
|
||||
[(Point::new(2, 0)..Point::new(2, 0), inserted_text)],
|
||||
Some(AutoindentMode::Block {
|
||||
original_start_columns: original_indent_columns.clone(),
|
||||
original_indent_columns: original_indent_columns.clone(),
|
||||
}),
|
||||
cx,
|
||||
);
|
||||
|
@ -1766,7 +1766,7 @@ fn test_autoindent_block_mode_without_original_indent_columns(cx: &mut App) {
|
|||
buffer.edit(
|
||||
[(Point::new(2, 12)..Point::new(2, 12), inserted_text)],
|
||||
Some(AutoindentMode::Block {
|
||||
original_start_columns: Vec::new(),
|
||||
original_indent_columns: Vec::new(),
|
||||
}),
|
||||
cx,
|
||||
);
|
||||
|
@ -1822,7 +1822,7 @@ fn test_autoindent_block_mode_multiple_adjacent_ranges(cx: &mut App) {
|
|||
(ranges_to_replace[2].clone(), "fn three() {\n 103\n}\n"),
|
||||
],
|
||||
Some(AutoindentMode::Block {
|
||||
original_start_columns: vec![0, 0, 0],
|
||||
original_indent_columns: vec![Some(0), Some(0), Some(0)],
|
||||
}),
|
||||
cx,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue