Skip to content

fix: indent only selected lines in note code blocks - #4801

Open
yashranaway wants to merge 2 commits into
CapSoftware:mainfrom
yashranaway:fix/notes-indent-selected-lines
Open

yashranaway wants to merge 2 commits into
CapSoftware:mainfrom
yashranaway:fix/notes-indent-selected-lines

Conversation

@yashranaway

@yashranaway yashranaway commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

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/5RetriggerView in Greptile

The fix appears safe to merge, with a non-blocking improvement to the outdent test.

Findings

  1. P2 Outdent changes go unchecked ▶
Fix with agent prompt
### Issue 1
apps/desktop-gpui/notes/tests/suite/editing.rs:400-406
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.

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!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Code-block indent and outdent now exclude a line that starts exactly where the selection ends.

  • Code-block indent and outdent stop at the selection boundary.

Reviews (1) · Last reviewed commit: "test: keep code indentation cases togeth..." · Reviewed by Greptile

@vercel
vercel Bot temporarily deployed to Preview – cap-status December 2, 2026 19:13 Inactive
@vercel

vercel Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Dec 2, 2026 7:13pm UTC

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"]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

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

1 inactive deployment
Preview – cap-status — ec0f5ed6 Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant