oh-my-posh: Corrupted prompt after certain commands

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

When running grep, the prompt immediately afterwards is corrupted - not sure if there’s other commands with similar issues yet.

Environment

  • Oh my Posh version: v3.75.0
  • Theme: custom - see below
  • Operating System: Win10 19042.746
  • Shell: Powershell 7.1.0
  • Terminal: Console Host <native>, Windows Terminal 1.4.3243.0
  • Grep: GNU grep 3.1 (bundled with git 2.29.2.windows.2)

Steps to Reproduce

  1. Run echo hi | grep hi
  2. Hear audible bell, and observe corrupted prompt

Expected behavior: [What you expected to happen]

  1. Uncorrupted prompt

Actual behavior: [What actually happened]

image

Notes

  • I also tested without the special characters in my config file (as they only work in Windows Terminal) - same issue

Theme

{
    "final_space": false,
    "console_title": true,
    "console_title_style": "template",
    "console_title_template": "[{{.Env.Host}}] {{.Path}}",
    "blocks": [
        {
            "type": "prompt",
            "alignment": "left",
            "horizontal_offset": 0,
            "vertical_offset": 0,
            "segments": [
            

                {
                    "type": "exit",
                    "style": "plain",
                    "foreground": "#16c50c",
                    
                    "properties": {
                        "display_exit_code": false,
                        "always_enabled": true,
                        "error_color": "#e74856",
                        "prefix": "\u279C"
                    }
                },
                
                {
                    "type": "path",
                    "style": "plain",
                    "foreground": "#61d6d6",
                    "properties": {
                        "style": "folder"
                    }
                },
                
                {
                  "type": "git",
                  "style": "plain",
                  "foreground": "#e74856",
                  
                  "properties": {
                  
                  "prefix": "<#3b78ff>git:(</>",
                  "postfix": "<#3b78ff>) </>",
                    "local_changes_icon": "\u2717",
                    "display_status": false,
                    "display_status_detail": false,
                    "display_stash_count": false,
                    "display_upstream_icon": false,
                    "working_color": "#e74856",
                    "branch_icon": ""
                  }
                }
            ]
        }
    ]
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (16 by maintainers)

Commits related to this issue

Most upvoted comments

I think I tested everything, also simplified the module in the meantime. Hope I didn’t break anything for someone else 🤞🏻

@lnu @peter-dolkens fixed it. I believe, at the time, I was battling combination of issues which led me down this path. I was able to directly invoke OMP now without the entire process bootstrap leading to a correctly displayed prompt in all circumstances. I’m going to test a little bit more but you should see a fix ASAP.

Great work - @JanDeDobbeleer!

Was a low-priority bug for me, but thought I had an easy enough repro for it to be worthwhile logging =D

With all due respect, this works with the out of the box version of OMP on my Windows machine as well, albeit PowerShell 5:

image

And… if I take the powershell bootstrap from starship and sets omp it works

image