microsoft / vscode

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

Extra space in terminal when using surrogate pair with oh-my-posh #230310

Open sharky98 opened 2 months ago

sharky98 commented 2 months ago

Type: Bug

Describe the problem:

When I use a surrogate pair (such as \udb80\udced for the nf-md-calendar icon), there is an extra space before the trailing diamond and after the content of the segment that does not get styled.

See https://github.com/JanDeDobbeleer/oh-my-posh/issues/5706 for original report.

To Reproduce:

Use a surrogate pair in any segment such as below.

{
  "blocks": [
      "segments": [
        {
          "background": "#234d70",
          "foreground": "#d6deeb",
          "leading_diamond": "<transparent,background>\ue0b0</>",
          "properties": {
            "time_format": "2006-01-02"
          },
          "style": "diamond",
          "template": " \udb80\udced {{ .CurrentDate | date .Format }} ",
          "trailing_diamond": "<background,transparent>\ue0b0</>",
          "type": "time"
        },
    ]
  ]
}

VS Code version: Code 1.93.1 (38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, 2024-09-11T17:20:05.685Z) OS version: Windows_NT x64 10.0.22631 Modes: Restricted

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 5900X 12-Core Processor (24 x 3700)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|31.93GB (21.24GB free)| |Process Argv|--disable-extensions --crash-reporter-id 247a7cb8-99a8-4524-ab7d-25bc9c85902f| |Screen Reader|no| |VM|0%|
Extensions disabled
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 0ee40948:31013168 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31102340 nativerepl2:31139839 refactort:31108082 pythonrstrctxt:31112756 flighttreat:31134774 wkspc-onlycs-t:31132770 nativeloc1:31134641 wkspc-ranged-t:31125599 cf971741:31144450 defaultse:31146405 iacca2:31150323 notype1:31150297 cc771715:31146322 ```
sharky98 commented 1 month ago

After investigating with a xterm.js member, it turns out that the issue lies in Windows providing system32\conhost.exe instead of the more recent OpenConsole.exe installed with Windows Terminal.

I saw an experimental options ("terminal.integrated.experimental.windowsUseConptyDll": true) that would use a bundled OpenConsole.exe. But, having already Windows Terminal installed, isn't there a way to make use of the provided OpenConsole.exe (when available) instead of using a bundled one?

https://github.com/xtermjs/xterm.js/discussions/5185