markdown: Don't adjust indentation when inserting with multiple cursors#40794
Conversation
|
So far the fix seems to work, the tests also passed locally, but i'm not 100% sure, so i'll be waiting for a team member to take a look at this approach and see if there's any issues with it. |
smitbarmase
left a comment
There was a problem hiding this comment.
I don't think it's the right approach to fix this bug, since it might affect a lot of languages. Let's not touch handle_input at all.
I wonder if we can fix this by making the Markdown language aware of indents within it. Notice how Python and Bash languages are implemented. You might want to look at this file:
And these PRs: #29625 and #33370.
I think the simplest solution would be defining increase_indent_pattern (more here). However, since a Markdown list item that’s a parent and a child look alike, I’m not sure if just this would work but it’s worth trying.
Let me know if you’re up for giving this a try. I can help you land this.
|
I honestly thought the same thing, it's why i was skeptical of this approach, i know the tests pass but it could break allot of languages, especially modifying one of the core input functions. And yeah, i'm 100% willing to give this a try, i'll be taking a deeper look into what you mentioned and move forward with that, thank you! |
|
I added some basic indentation rules. This is my first time working with a schema file, so I’m still learning. I also experimented with defining both |
|
Hello @smitbarmase! I’ve updated the PR based on your feedback (moved the logic to Markdown’s indent rules and reverted the handle_input change). |
smitbarmase
left a comment
There was a problem hiding this comment.
This looks good. I added one fix and its test to make sure we don't indent on newline and instead keep the indent from the current line we’re moving from. Sorry for delaying this for so long. Thanks so much.
|
No need to apologize at all, and thank you! |
…rs (zed-industries#40794) Closes zed-industries#40757 ## Summary This PR addresses an issue where Zed incorrectly adjusts the indentation of Markdown lists when inserting text using multiple cursors. Currently: - Editing individual lines with a single cursor behaves correctly (no unwanted indentation changes). - Using multiple cursors, Zed automatically adjusts the indentation, unlike VS Code, which preserves the existing formatting. ## Tasks - [x] Implement a new test to verify correct Markdown indentation behavior with multiple cursors. - [x] Apply the fix to prevent Zed from adjusting indentation when inserting text on multiple cursors. ------------------------ Release Notes: - Fixed an issue where inserting text with multiple cursors inside a nested Markdown list would cause it to lose its indentation. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Builds on #40794 and #44381 - Fixes the case where creating a new line inside a nested list puts the cursor correctly under that nested list item. - Fixes the case where typing a new list item at the expected indent no longer auto-indents or outdents incorrectly. Release Notes: - Fixed an issue in Markdown where new list items weren’t respecting the expected indentation on type.
Builds on zed-industries#40794 and zed-industries#44381 - Fixes the case where creating a new line inside a nested list puts the cursor correctly under that nested list item. - Fixes the case where typing a new list item at the expected indent no longer auto-indents or outdents incorrectly. Release Notes: - Fixed an issue in Markdown where new list items weren’t respecting the expected indentation on type.
…rs (zed-industries#40794) Closes zed-industries#40757 ## Summary This PR addresses an issue where Zed incorrectly adjusts the indentation of Markdown lists when inserting text using multiple cursors. Currently: - Editing individual lines with a single cursor behaves correctly (no unwanted indentation changes). - Using multiple cursors, Zed automatically adjusts the indentation, unlike VS Code, which preserves the existing formatting. ## Tasks - [x] Implement a new test to verify correct Markdown indentation behavior with multiple cursors. - [x] Apply the fix to prevent Zed from adjusting indentation when inserting text on multiple cursors. ------------------------ Release Notes: - Fixed an issue where inserting text with multiple cursors inside a nested Markdown list would cause it to lose its indentation. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
…usly (zed-industries#44381) Closes zed-industries#44223 Regressed in zed-industries#40794 in attempt to fix zed-industries#40757. This PR handles both cases and add more tests around it. Bug is only in Nightly. Release Notes: - N/A
Builds on zed-industries#40794 and zed-industries#44381 - Fixes the case where creating a new line inside a nested list puts the cursor correctly under that nested list item. - Fixes the case where typing a new list item at the expected indent no longer auto-indents or outdents incorrectly. Release Notes: - Fixed an issue in Markdown where new list items weren’t respecting the expected indentation on type.
…rs (zed-industries#40794) Closes zed-industries#40757 ## Summary This PR addresses an issue where Zed incorrectly adjusts the indentation of Markdown lists when inserting text using multiple cursors. Currently: - Editing individual lines with a single cursor behaves correctly (no unwanted indentation changes). - Using multiple cursors, Zed automatically adjusts the indentation, unlike VS Code, which preserves the existing formatting. ## Tasks - [x] Implement a new test to verify correct Markdown indentation behavior with multiple cursors. - [x] Apply the fix to prevent Zed from adjusting indentation when inserting text on multiple cursors. ------------------------ Release Notes: - Fixed an issue where inserting text with multiple cursors inside a nested Markdown list would cause it to lose its indentation. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
…usly (zed-industries#44381) Closes zed-industries#44223 Regressed in zed-industries#40794 in attempt to fix zed-industries#40757. This PR handles both cases and add more tests around it. Bug is only in Nightly. Release Notes: - N/A
Builds on zed-industries#40794 and zed-industries#44381 - Fixes the case where creating a new line inside a nested list puts the cursor correctly under that nested list item. - Fixes the case where typing a new list item at the expected indent no longer auto-indents or outdents incorrectly. Release Notes: - Fixed an issue in Markdown where new list items weren’t respecting the expected indentation on type.
Closes #40757
Summary
This PR addresses an issue where Zed incorrectly adjusts the indentation of Markdown lists when inserting text using multiple cursors. Currently:
Tasks
Release Notes: