Skip to content

Conversation

@remorses
Copy link
Contributor

@remorses remorses commented Nov 27, 2025

Summary

  • Enable linefeed mode when creating new terminal instances so \n properly moves cursor to column 0
  • Without this PR the result does not render correctly if it uses \n for new lines instead of \r\n

Problem

Without linefeed mode enabled, \n only moves the cursor down without returning to column 0. This causes text to display in a staggered pattern:

Line 1
      Line 2
            Line 3

Solution

Set wrapper.terminal.modes.set(.linefeed, true) after terminal creation in the WASM API. This makes \n behave as expected (LF + CR), properly returning the cursor to column 0:

Line 1
Line 2
Line 3

Copilot AI review requested due to automatic review settings November 27, 2025 14:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a terminal display issue where newline characters (\n) don't properly return the cursor to column 0, causing text to display in a staggered pattern. The fix enables linefeed mode when creating new terminal instances in the WASM API.

Key Changes:

  • Enable linefeed mode by setting wrapper.terminal.modes.set(.linefeed, true) after terminal initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Without linefeed mode enabled, \n only moves the cursor down without
returning to column 0. This causes text to display in a staggered pattern
instead of properly aligned at the left margin.

This fix sets the linefeed terminal mode to true when creating a new
terminal instance, making \n behave as expected (LF + CR).
@remorses remorses force-pushed the fix/enable-linefeed-mode branch from 86ebd9c to a95af7f Compare November 27, 2025 14:38
Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@kylecarbs kylecarbs merged commit 62ccefc into coder:main Dec 1, 2025
5 checks passed
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.

2 participants