JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.79k stars 2.35k forks source link

Always a newline before rendering prompt #701

Closed Descalon closed 3 years ago

Descalon commented 3 years ago

Prerequisites

Description

After every command (or before rendering the prompt) a newline is added.

Environment

Steps to Reproduce

  1. Open a terminal
  2. type Write-Host foo
  3. See the new line before the newly rendered prompt

Expected behavior: No new line before rendering prompt (or make it customizable through config): Screenshot 2021-05-04 170447

Actual behavior: [What actually happened] Newline before rendering prompt: Screenshot 2021-05-04 170406

JanDeDobbeleer commented 3 years ago

@Descalon that smells like a bug. I'll check.

JanDeDobbeleer commented 3 years ago

@Descalon how do you invoke oh-my-posh? I don't have this issue.

Windows (using the push module):

image

macOS (Invoke-Expression):

image
Descalon commented 3 years ago

I'm importing the module and invoking Set-PoshPrompt -Theme:

Import-Module Get-ChildItemColor

$Env:GIT_SSH = $null
Import-Module -Name posh-git
Import-Module -Name posh-sshell
Import-Module -Name posh-with

Import-Module -Name oh-my-posh

$modulePath = Resolve-Path "$PSScriptRoot/PsExtensions.psm1"
Import-Module $modulePath -Force

Set-PoshPrompt -Theme agnoster

Set-PSReadLineOption -Colors @{
    Parameter = 'DarkMagenta'
    Operator = 'Magenta'
    String = 'Green'
}

Import-Module -Name ZLocation
JanDeDobbeleer commented 3 years ago

I'll check, maybe posh-with has something to do with it.

Descalon commented 3 years ago

Your guess as it being one of the other modules is correct! It was Get-ChildItemColor: image

Descalon commented 3 years ago

I'll take this issue up with the maintainer for that module! Thanks for the help, though!

rollingmoai commented 2 years ago

@JanDeDobbeleer In my case, a newline keeps on getting created until the prompt is filled up.

Here you can notice that the newline is not rendered on the end: image

My $PROFILE only contains this:

Invoke-Expression (oh-my-posh --init --shell pwsh --config "themes\iterm2.omp.json")
JanDeDobbeleer commented 2 years ago

@itsmeboy0 I'll check that theme. There's zero logic that can explain it popping up sometimes and sometimes not in oh-my-posh.

JanDeDobbeleer commented 2 years ago

@itsmeboy0 found it! Its because of "vertical_offset": 1, which pushes the prompt down 1 line. And at the end of the terminal, there's obviously no space which is why it's not an issue there. That took me WAY tool long to see 😓

JanDeDobbeleer commented 2 years ago

@itsmeboy0 https://github.com/JanDeDobbeleer/oh-my-posh/pull/1074

rollingmoai commented 2 years ago

Great. Removing that has worked, thanks

github-actions[bot] commented 5 months ago

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. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.