Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line edit is wrecking havoc with indention #21334

Open
1 task done
GOPiGal opened this issue Nov 29, 2024 · 2 comments
Open
1 task done

Multi-line edit is wrecking havoc with indention #21334

GOPiGal opened this issue Nov 29, 2024 · 2 comments
Labels
bug [core label] editor Feedback for code editing, formatting, editor iterations, etc setting Feedback for preferences, configuration, etc

Comments

@GOPiGal
Copy link

GOPiGal commented Nov 29, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When using multi-line edit ([Alt]+[Shift]+[arrow keys] to select where and which line) and inserting a char into indented space auto indention is executed which wreck havoc with indention already defined. If multi-line cursor is released there is no way later to multi-line delete the change. This is extremely important in cases of indention sensitive formats like Python or YAML. Example below shows the issue (I know I can use [Ctrl]+[/] for toggle comment and it works but commenting is not the only case when multiple lines are edited and I have selected this example just for clarity.)

Example is shown on YAML file.

Steps shown below:

  1. Create multi-line cursor at the beginning of multiple lines
  2. Insert [#]
  3. Cursor is released
  4. Same as step 1
  5. Deletion of one character [Del]
    It removed only some of the "#" and Indention is broken even in places where they were removed
    Indention Broken

Now even if "#" is removed manually deleting just this one character in each line the indention is broken and differs from the initial one as shown below.
After manual removal

Environment

System Specs:
Zed: v0.163.2 (Zed)
OS: Linux X11 rocky 9.5
Memory: 125.5 GiB
Architecture: x86_64
GPU: NVIDIA RTX 5000 Ada Generation Laptop GPU || NVIDIA || 565.57.01

Zed configuration (~/.config/zed/settings.json):
{
"base_keymap": "Atom",
"telemetry": {
"diagnostics": false,
"metrics": false
},
"ui_font_size": 16,
"buffer_font_size": 16,
"theme": {
"mode": "system",
"light": "Solarized Dark",
"dark": "One Dark",
"tabWidth": 2,
"useTabs": false
},
"project_panel": {
"dock": "left",
"auto_fold_dirs": false
},
"languages": {
"YAML": {
"prettier": {
"bracketSpacing": false,
"auto_indent_on_paste": false,
"set auto_indent_using_last_non_empty_line": false
}
}
}
}

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

@GOPiGal GOPiGal added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Nov 29, 2024
@GOPiGal
Copy link
Author

GOPiGal commented Nov 29, 2024

Suggestion for solution:
Allow disabling auto-indention in multi-line mode per format. E.g.
"languages": {
"YAML": {
"auto_indent_in_multiline_edit_mode": false,
}
}

@JosephTLyons JosephTLyons added editor Feedback for code editing, formatting, editor iterations, etc setting Feedback for preferences, configuration, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Dec 4, 2024
@rope-hmg
Copy link

If suggested solution is accepted, could we have a global setting too? I've been wanting to turn this off for ages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] editor Feedback for code editing, formatting, editor iterations, etc setting Feedback for preferences, configuration, etc
Projects
None yet
Development

No branches or pull requests

3 participants