[BUG] Have consistent line number indentation for the whole suggested edit
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Edge case (and only "nice to have"): suggested edits may indent the actual code with different amount of space. The reason is the different length of displayed line numbers. At the screenshot, the indentation is increased by 1 space between lines, 89 and 91. The 91 has more indentation to align correctly with a later 100.
This visually disturbs how code is displayed above and below the "gap".
<img width="433" height="549" alt="Image" src="https://github.com/user-attachments/assets/ad6d972d-a45c-40ef-83f9-76c66002cf93" />
What Should Happen?
The code should be aligned vertically independent from whether the line numbering takes more space for different sections of displayed code.
A solution would consider only the last line number of all displayed sections for the line numbering/indentation of all code blocks.
Error Messages/Logs
Steps to Reproduce
- Create an original file.
cat formatter.rb:
class Formatter
def self.format(value)
value.to_s.strip
end
def self.truncate(value, length)
return value if value.length <= length
value[0, length] + "..."
end
def self.titleize(value)
value.split(" ").map(&:capitalize).join(" ")
end
end
- Ask claude to edit the file which results in diffs in sections before and after a 10**n line number
in `formatter.rb`, please `.downcase` the result. Additionally, rename `titleize` to `title_case`. Perform both changes with a single edit.
- The Update is displayed like this:
<img width="757" height="612" alt="Image" src="https://github.com/user-attachments/assets/d4d07ef1-ea6c-4e6b-82b1-87188f927fd1" />
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Claude Code Version
2.1.187
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)