Cursor loses a code block's base indentation after generation — first line flush left, relative line indentation kept but block base indent gone(Linux, since ~3.25.9, used to be fine)

Title: Cursor (Linux, since ~3.25.9, used to be fine) loses a code block’s base indentation after generation — first line flush left, relative line indentation kept but block base indent gone

When Cursor generates a Python code block that should have a base indentation (e.g. code inside a function), it looks fine while streaming. But as soon as generation finishes, the whole block jumps left: the first line goes flush to the left edge, and every following line shifts left by the same amount. The relative indentation between lines is still there, but the block’s base indentation is gone.

Anyone else seeing this? Is it a known regression? Is there a setting or workaround to stop this post-generation dedent?

python code

generating

complete

Hi there!

We detected that this may be a bug report, so we’ve moved your post to the Bug Reports category.

To help us investigate and fix this faster, could you edit your original post to include the details from the template below?

Bug Report Template - Click to expand

Where does the bug appear (feature/product)?

  • Editor, Tab & Chat (autocomplete, Composer, in-editor agent)
  • Terminal & commands
  • Models, pricing & API keys (availability, Auto/Max, BYOK/Bedrock)
  • MCP & tools
  • Cloud Agents & Automations (cursor.com/agents, scheduled/event)
  • BugBot & Code Review
  • Cursor CLI
  • Cursor Mobile
  • Remote (SSH / Dev Containers / WSL)
  • Account, billing & login
  • Something else…

Describe the Bug
A clear and concise description of what the bug is.


Steps to Reproduce
How can you reproduce this bug? We have a much better chance at fixing issues if we can reproduce them!

  1. …
  2. …
  3. …

Expected Behavior
What is meant to happen here that isn’t working correctly?


Screenshots / Screen Recordings
If applicable, attach images or videos (.jpg, .png, .gif, .mp4, .mov)


Operating System

  • Windows 10/11
  • MacOS
  • Linux

Version Information

  • For Cursor IDE: Menu → About Cursor → Copy
  • For Cursor CLI: Run agent about in your terminal
IDE:
Version: 2.xx.x
VSCode Version: 1.105.1
Commit: ......

CLI:
CLI Version 2026.01.17-d239e66

For AI issues: which model did you use?
Model name (e.g., Sonnet 4, Tab…)


For AI issues: add Request ID with privacy disabled
Request ID: f9a7046a-279b-47e5-ab48-6e8dc12daba1
For Background Agent issues, also post the ID: bc-…


Additional Information
Add any other context about the problem here.


Does this stop you from using Cursor?

  • Yes - Cursor is unusable
  • Sometimes - I can sometimes use Cursor
  • No - Cursor works, but with this issue

The more details you provide, the easier it is for us to reproduce and fix the issue. Thanks!

Hi @haozhu_lu,

This is intentional rather than something that broke. Since 3.10, chat removes the indentation that every line of a code block shares once the block is complete, so snippets taken from deeply nested code don’t sit far to the right. It applies to every fenced block, and the copy button copies the block as shown. There’s no setting to turn it off right now.

A few ways around it for now:

  • Ask the model to include the enclosing class line in the snippet. When one line starts at the left edge, nothing should get stripped, so the method keeps its indentation.
  • Let the agent apply the change to the file directly instead of copying it from chat.
  • After pasting, select the pasted lines and press Tab to indent them back one level.

Hi Colin, thanks for the explanation — I understand now that this is intentional by design. If there’s a plan on the roadmap to add a setting to disable the dedent behavior, I think it would help in some special cases, so I’d appreciate it being considered.