[PR #14700] Add support for IRM (Insert Replace Mode) #30225

Closed
opened 2026-01-31 09:39:25 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/14700

State: closed
Merged: Yes


This PR add support for the ANSI Insert/Replace mode (IRM), which
determines whether output characters are inserted at the active cursor
position, moving existing content to the right, or whether they should
overwrite the content that is already there.

The implementation is a bit of a hack. When that mode is enabled, it
first measures how many cells the string is expected to occupy, then
scrolls the target line right by that amount before writing out the new
text.

In the longer term it might be better if this was implemented entirely
in the TextBuffer itself, so the scrolling could take place at the
same time as the content was being written.

Validation Steps Performed

I've added a very basic unit test that verifies the mode is working as
expected. But I've also done a lot more manual testing, confirming edge
cases like wide characters, double-width lines, and both with and
without wrapping mode enabled.

Closes #1947

**Original Pull Request:** https://github.com/microsoft/terminal/pull/14700 **State:** closed **Merged:** Yes --- This PR add support for the ANSI Insert/Replace mode (`IRM`), which determines whether output characters are inserted at the active cursor position, moving existing content to the right, or whether they should overwrite the content that is already there. The implementation is a bit of a hack. When that mode is enabled, it first measures how many cells the string is expected to occupy, then scrolls the target line right by that amount before writing out the new text. In the longer term it might be better if this was implemented entirely in the `TextBuffer` itself, so the scrolling could take place at the same time as the content was being written. ## Validation Steps Performed I've added a very basic unit test that verifies the mode is working as expected. But I've also done a lot more manual testing, confirming edge cases like wide characters, double-width lines, and both with and without wrapping mode enabled. Closes #1947
claunia added the pull-request label 2026-01-31 09:39:25 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30225