Repository navigation
fix: indent only selected lines in note code blocks - #4801
Open
yashranaway wants to merge 2 commits into
Open
yashranaway wants to merge 2 commits into
yashranaway wants to merge 2 commits into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Comment on lines
+400
to
+406
| let mut editor = editor("```\none\ntwo\n```"); | ||
| select(&mut editor, (0, 0), (0, 4)); | ||
| editor.indent(); | ||
| assert_eq!(texts(&editor), ["\tone\ntwo"]); | ||
| assert_eq!(editor.selected_plain_text(), "one\n"); | ||
| editor.outdent(); | ||
| assert_eq!(texts(&editor), ["one\ntwo"]); |
Contributor
There was a problem hiding this comment.
The new test cannot catch outdent changing the unselected next line: two has no leading whitespace, so including it in outdent leaves the asserted text unchanged. Give that line a leading tab and assert that it survives both operations. This would protect the outdent behavior promised by this fix.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/notes/tests/suite/editing.rs
Line: 400-406
Comment:
**Outdent changes go unchecked**
The new test cannot catch outdent changing the unselected next line: `two` has no leading whitespace, so including it in outdent leaves the asserted text unchanged. Give that line a leading tab and assert that it survives both operations. This would protect the outdent behavior promised by this fix.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Selecting a code line through its newline and pressing Tab also indented the next line. Indent and outdent now stop at the end of the selection.
The regression reproduced the extra tab. It checks the resulting text, selection and outdent behavior. The full notes suite passes on Linux.
Confidence Score: 4/5

The fix appears safe to merge, with a non-blocking improvement to the outdent test.
Findings
Fix with agent prompt
Summary
Code-block indent and outdent now exclude a line that starts exactly where the selection ends.
Reviews (1) · Last reviewed commit: "test: keep code indentation cases togeth..." · Reviewed by Greptile