Skip to content

Conversation

@vladikcomper
Copy link

@vladikcomper vladikcomper commented Nov 28, 2025

Fixes #439

Bash terminal no longer functioned in Terminus under newer Linux distros (Fedora 43+, Arch etc). These distros propagate a new "OSC Context" feature to the default profile, which generates OSC sequence Terminus fails to find the end of.

There's a bug in parsing OSC (Operating System Command) sequences sent to the terminal, which use ESC \ as a terminator (as specified in ECMA-48). Specifically, OSC 3008 is encoded as follows per OSC Context specification:

General Syntax

This builds on ECMA-48, and reuses the OSC and ST concepts introduced there.

For sequences following this specification it is recommended to encode OSC as 0x1B 0x5D, and ST as 0x1B 0x5C.

Basically, sequence start is encoded as ESC ] (which Terminus recognizes) and terminator is encoded as ESC \ (which isn't supported), so Terminus just reads following bytes indefinitely.

I believe it's because Terminus mostly focuses on emulating simpler VTxxx-compatible terminals, however, it now seems we need to support at list some parts of ECMA-48 to keep up with modern terminals.

Reproducing the issue

  1. Run any Linux distro with Systemd 258 or newer (e.g. Fedora 43 or newer);
  2. Make sure you have /etc/profile.d/80-systemd-osc-context.sh file, which injects OSC 3008 sequence to your terminal;
  3. You should see bytes ]3008; in Sublime's internal Console when you running Terminus with debug: true (set in Preferences > Package Settings > Terminus > Settings);

See my comment in the original issue for more information.

Before this PR: Terminal output is corrupted, Bash terminal unusable under Terminus.

After this PR: Bash terminal works as expected again.

systemd 258 introduced OSC 3008 to Bash profile, which caused Terminus to hang. This OSC uses a special terminator (ESC + \), which wasn't recognized.
ALLOWED_IN_CSI = "".join([ctrl.BEL, ctrl.BS, ctrl.HT, ctrl.LF,
ctrl.VT, ctrl.FF, ctrl.CR])
OSC_TERMINATORS = set([ctrl.ST_C0, ctrl.ST_C1, ctrl.BEL, ctrl.CR])
OSC_TERMINATORS = set([ctrl.ST_C0, ctrl.ST_C1, ctrl.BEL, ctrl.CR, ctrl.ESC + '\\'])
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, ctrl.ST_C0 == ctrl.ESC + '\'

Hence this addition is redundant.

Copy link
Author

Choose a reason for hiding this comment

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

Ah, thanks for pointing this out. Your approach in #464 seems cleaner then!

@vladikcomper
Copy link
Author

#464 addresses the same issue in a cleaner way; I believe @deathaxe's solution is a way to go

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.

Terminus not showing text

2 participants