Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code to ignore OSC commands #2326

Merged
merged 3 commits into from Aug 18, 2022

Conversation

tannewt
Copy link
Contributor

@tannewt tannewt commented Aug 10, 2022

CircuitPython 8 uses OSC to set title.

CircuitPython 8 uses OSC to set title.
@carlosperate
Copy link
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?

@tannewt
Copy link
Contributor Author

tannewt commented Aug 11, 2022

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:

@@ -182,6 +182,9 @@ def __init__(self, connection, theme="day", parent=None):
self.vt100_regex = re.compile(
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
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\[?

Copy link
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/

Copy link
Member

@carlosperate carlosperate left a comment

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 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.

None yet

2 participants