mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
TextDocument: Fix indentation duplicating spaces
Auto indentation will consider only leading spaces before the cursor. Fixes #8973.
This commit is contained in:
parent
7d4e3f01dd
commit
5e87c798d2
1 changed files with 4 additions and 0 deletions
|
@ -786,6 +786,10 @@ void InsertTextCommand::perform_formatting(const TextDocument::Client& client)
|
|||
|
||||
for (auto input_char : m_text) {
|
||||
if (input_char == '\n') {
|
||||
size_t spaces_at_end = 0;
|
||||
if (column < line_indentation)
|
||||
spaces_at_end = line_indentation - column;
|
||||
line_indentation -= spaces_at_end;
|
||||
builder.append('\n');
|
||||
column = 0;
|
||||
if (should_auto_indent) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue