-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Support for OSC 9;9 #409
Comments
That's an easy addition. Can do. |
@JanDeDobbeleer do i need to configure it? it's not working in powershell 7 on windows 10 in windows terminal preview (1.6). |
@floh96 you updated right? I didn't validate it yet, but that's exactly what's added to the prompt now. |
yeah i'm using version 3.89.0 |
I'll check this evening maybe I did something stupid |
Alright I'll go ahead and ask. I skimmed the linked issues, and the PR Jan wrote, and I don't get it. |
@travistx it's an ansi escape sequence that informs the terminal (windows terminal and conemu are supporting it) about the current working directory. When your current working directory is C:\Users for example and you are duplicating your tab in windows terminal with ctrl+shift+d (the keybinding is not bound in the default configuration, you must manually add it to your settings.json in windows terminal) the working directory of the new tab is also C:\Users. |
I built OMP3 from source, the way I usually do, and can confirm this isn't working for me either. I confirmed OMP3 is emitting something that looks correct with my limited knowledge of this. Here's the output, base64 encoded:
CTRL+SHIFT+D opens a new tab with my normal starting directory. |
@travistx it's only supported in the windows terminal preview version (1.6) atm i should have mentioned that |
Test preview also. Same result. |
Maybe the quotes are required. |
|
@travistx @floh96 I adjusted the sequence according to what's expected and yet still it doesn't work for V3. A bit puzzled here tbh. |
But is it integrated in the latest windows terminal preview? |
@lnu fair point, I assumed so. Allow me to validate on ConEmu. |
@JanDeDobbeleer maybe it has something to do with the config of your windows terminal like default starting folder or something like that |
@lnu I feel a bit like an idiot as it should work in my latest PR according to the spec. I'll take a look tomorrow during my lunch break, maybe I made a silly mistake I just don't see now. |
I got it working on the diff --git a/src/ansi_formats.go b/src/ansi_formats.go
index 0306d09..fb0e910 100644
--- a/src/ansi_formats.go
+++ b/src/ansi_formats.go
@@ -76,7 +76,7 @@ func (a *ansiFormats) init(shell string) {
a.escapeLeft = ""
a.escapeRight = ""
a.hyperlink = "\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\"
- a.osc99 = "\x1b]9;9;\"%s\"\x9c"
+ a.osc99 = "\x1b]9;9;\"%s\"\x1b\\"
}
}
or diff --git a/src/ansi_formats.go b/src/ansi_formats.go
index 0306d09..778251e 100644
--- a/src/ansi_formats.go
+++ b/src/ansi_formats.go
@@ -76,7 +76,7 @@ func (a *ansiFormats) init(shell string) {
a.escapeLeft = ""
a.escapeRight = ""
a.hyperlink = "\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\"
- a.osc99 = "\x1b]9;9;\"%s\"\x9c"
+ a.osc99 = "\x1b]9;9;\"%s\"\x07"
}
}
I was looking at https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC:
My understanding is that the sequence can either end in |
You're right. With this it works |
I'll adjust, validate and merge! Thanks @chenxiaolong you made my day. |
by the way, I've seen you named the template osc99. Maybe we should rename the hyperlink template to osc8. |
Did anyone try with wsl. It crashes when duplicating on my side. I found this script while googling:https://gist.github.com/skyline75489/d655aede4c729eff178a1c0bfd10f622 |
@lnu did you go for the first or second sample @chenxiaolong provided? The link you shared is using the first variation. |
The same as the hyperlink. Ending with |
I also did some tests with the status indicator code osc 9;4 (microsoft/terminal#8055). Would be cool to see the taskbar flashing when a long operation is running. |
I confirm I'm not able to duplicate a wsl tab with the osc9;9 code emitted. Without it, the tab is duplicated correctly. To make it work with wsl, we have to do the same as here:
this code will correctly set the curent folder for wsl. |
@lnu this still doesn't work for me in WT (have the preview), can you validate my branch so we can merge? |
let me check this. In the meantime I'm adding a function on environment to detect wsl or not and transform the path accordingly. => #413 |
@JanDeDobbeleer it works with your banch on my side. Just one question: why using x033 instead of x1b like for hyperlinks? Both works so maybe we can just keep the same for all osc sequences? |
Yes, I was under the impression you said it didn't work with that. As what I see is @chenxiaolong first sample now? |
@JanDeDobbeleer Ok 033, x1b all the same :). so choose which one you want and you can use it for console, hyperlink and current folder. I tested both and it's ok. Sorry for the misunderstanding. |
I'm adjusting it |
@lnu missed this one, in favour of merging your branch instead. Ping me on Twitter when done, I'm starting my day ;-) |
Available in 3.39.1 |
@floh96 Can you confirm all is working now with version 3.89.1? |
@lnu i will check after work |
@lnu @JanDeDobbeleer it's working now in powershell and wsl thank you ❤️ |
@floh96 heads-up, I created a config switch for this at root level for the next version as enabling it by default effectively triggers a notification on iTerm2 😂 |
Sorry... just checked the doc of iterm2. The pandora box is opened: osc 9;9 not being standard across terminals, everyday will be a source of happiness 😅 |
Hey folks, this no longer seems to be working. I wonder if it's because instead of |
Still working in pwsh but no more with wsl, checking why. same as here #1508? |
fixed here with #1516 |
Is this what's causing my bash prompt to show this weird piece of code? (I've been searching everywhere for "9;9" and all I could find were binary matches in files, and this issue) also, if I up then down (go to the previous command in history then back to clear line), it goes away. oh yeah, I'm using |
@joaociocca yes. And depending on the terminal you might need to disable that in the config (theme) as bot all of them support it. |
@JanDeDobbeleer pardon my noobness, how can I disable it in this case? |
@joaociocca is that theme file on your file system? As there's a parameter in there |
@JanDeDobbeleer yes, I downloaded a copy of |
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. |
It would be nice if the oh-my-posh v3 powershell module would support OSC 9;9. It was supported in v2.
Windows Terminal added support for OSC 9;9 for the preview version (1.6) recently see microsoft/terminal#8330 and microsoft/terminal#8934.
The text was updated successfully, but these errors were encountered: