microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.39k stars 29.32k forks source link

Unexpected backslash ( \ ) when opening git bash with oh my zsh in vscode terminal #212227

Open prime0x2 opened 6 months ago

prime0x2 commented 6 months ago

Describe the bug

I have git in my Windows 10. I installed zsh and was trying to add oh my zsh to give it new look. Everything is fine except when I open Git Bash in terminal it adds a backslash before my prompt. I've added a screenshot below for reference.

image

Note: This is happening on my office laptop (windows 10). It also happened when I tried to do the same thing on my personal laptop (windows 10). Same scenario, same issue. This only happens when I open Git Bash in vscode terminal. It doesn't happen when I open Git Bash directly. Here is a screenshot of Git Bash opening directly

image

This only happens in Git Bash. I installed WSL Ubuntu and did the same thing, but there is no problem. When I open WSL ubuntu in vscode terminal, there is no backslash (as it should be).

This was happening for a long time on my personal laptop. Tried to find any solution, but didn't find anything regarding this issue so I thought may be it's my machine. But I got a new job and got a new laptop, same problem appears. That's when I knew something is off.

So, I was hoping is there any solution to this?

I have also created an issue to https://github.com/ohmyzsh/ohmyzsh/issues/12398 here. But they are saying its an issue with VS Code version. https://github.com/ohmyzsh/ohmyzsh/issues/11765 check here

Steps to reproduce

OS: Windows 10

  1. Install Git Bash to the system
  2. Install ZSH, VS Code
  3. Install Oh My ZSH
  4. Open VS Code terminal (By default it opens powershell)
  5. From VS Code terminal list, open Git Bash

Expected behavior

This is WSL when opening in VS Code terminal

image

This is when I open Git Bash directly

image

This is how it should be

Screenshots and recordings

This is when I open Git Bash from VS Code terminal

image

OS / Linux distribution

Windows 10

Zsh version

5.9

Oh My Zsh version

master (668ca3a)

Terminal emulator

Git Bash

Does this issue occur when all extensions are disabled?: Yes/No Yes

mcornella commented 6 months ago

This was seen to be fixed in the latest insider version (https://github.com/ohmyzsh/ohmyzsh/issues/11765#issuecomment-2081124930) but it seems you still see this issue in the latest version so that's weird...

The minimal code that was seen to reproduce the issue (print a backslash character) was:

printf '\e]7;file://%s%s\e\' HOSTNAME /c/Users/user/Desktop

In theory this string is following the OSC7 standard sequence.

prime0x2 commented 6 months ago

This was seen to be fixed in the latest insider version (ohmyzsh/ohmyzsh#11765 (comment)) but it seems you still see this issue in the latest version so that's weird...

The minimal code that was seen to reproduce the issue (print a backslash character) was:

printf '\e]7;file://%s%s\e\' HOSTNAME /c/Users/user/Desktop

In theory this string is following the OSC7 standard sequence.

I followed this ( https://github.com/ohmyzsh/ohmyzsh/issues/11765#issuecomment-2081124930 ) but it still happens. Not fixed yet.

Note: I'm not using MSYS. I'm using Git Bash. Opening Git Bash directly doesn't have this issue but opening Git Bash in VS Code (stable and insider both) Terminal triggering this issue.

meganrogge commented 6 months ago

does disabling shell integration, terminal.integrated.shellIntegration.enabled, help?

prime0x2 commented 6 months ago

does disabling shell integration, terminal.integrated.shellIntegration.enabled, help?

no. already tried that but no help

meganrogge commented 6 months ago

did this reproduce in earlier versions of vs code?

prime0x2 commented 6 months ago

yeah, I had this problem for around 7/8 months. At that time, I only had one machine, so I always thought it was my problem alone. Then recently when I got new machine from office, I faced same issue with clean setup. That's when I decided to open issue.

kirito41dd commented 2 months ago

same problem 图片

Tyriar commented 2 months ago

@prime0x2 on Insiders does it reproduce if you set "terminal.integrated.experimental.windowsUseConptyDll": true?