Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.

Add code to ignore OSC commands - #2326

Merged
carlosperate merged 3 commits into
mu-editor:masterfrom
tannewt:ignore_osc_codes
Aug 18, 2022
Merged

Add code to ignore OSC commands#2326
carlosperate merged 3 commits into
mu-editor:masterfrom
tannewt:ignore_osc_codes

Conversation

@tannewt

@tannewt tannewt commented Aug 10, 2022

Copy link
Copy Markdown
Contributor

CircuitPython 8 uses OSC to set title.

CircuitPython 8 uses OSC to set title.
@carlosperate

Copy link
Copy Markdown
Member

Thanks for the PR @tannewt!

PR #2323 has been merged, so rebasing or merging main should resolve the CI failures.

I'm not that familiar with OSC commands, is this a generic way to change a terminal title bar?

Comment thread tests/interface/test_panes.py Outdated
@tannewt

tannewt commented Aug 11, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for the PR @tannewt!

np, thanks for the fast review!

PR #2323 has been merged, so rebasing or merging main should resolve the CI failures.

Done!

I'm not that familiar with OSC commands, is this a generic way to change a terminal title bar?

Correct OSC commands are Operating System Commands that were defined by xterm early on. A couple of them are specific to setting the terminal title. (Icon name is the text for the window's icon in a task bar.) Here are two good references:

@tannewt
tannewt requested a review from carlosperate August 16, 2022 20:55
Comment thread mu/interface/panes.py
r"\x1B\[(?P<count>[\d]*)(;?[\d]*)*(?P<action>[A-Za-z])"
)
self.osc_regex = re.compile(
r"\x1B\](?P<command>[\d]*);(?P<string>[^\x1B]*)\x1B\\"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this regex not start with r"\x1B\[?

@carlosperate carlosperate Aug 18, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No wait, I was looking at the wrong command, nevermind, this is the one to match: https://terminalguide.namepad.de/seq/osc-0/

@carlosperate carlosperate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! 👍
Tested with a real device as well and works well, thanks!

@carlosperate
carlosperate merged commit a56049f into mu-editor:master Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants