zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.93k stars 3.15k forks source link

Multi-line edit is wrecking havoc with indention #21334

Open GOPiGal opened 2 days ago

GOPiGal commented 2 days ago

Check for existing issues

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 commented 2 days ago

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