input: Fix outdent when selection first line is no indent. (#903)
## Before https://github.com/user-attachments/assets/67f94a09-b01b-43e4-9809-2e876f53a7b7 ## After https://github.com/user-attachments/assets/0ff7fee8-cbbc-4f55-8877-96c7ad07d662
This commit is contained in:
parent
5419600fcd
commit
9073818d4e
1 changed files with 5 additions and 3 deletions
|
|
@ -1304,10 +1304,12 @@ impl InputState {
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
removed_len += tab_indent.len();
|
removed_len += tab_indent.len();
|
||||||
}
|
|
||||||
|
|
||||||
// +1 for "\n"
|
// +1 for "\n"
|
||||||
offset += line.len().saturating_sub(tab_indent.len()) + 1;
|
offset += line.len().saturating_sub(tab_indent.len()) + 1;
|
||||||
|
} else {
|
||||||
|
offset += line.len() + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.selected_range = start_offset..selected_range.end.saturating_sub(removed_len);
|
self.selected_range = start_offset..selected_range.end.saturating_sub(removed_len);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue