mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
fix(tcsh): print literal newline char with leading space
it be like that sometimes, I also have no clue why this is necessary resolves #5105
This commit is contained in:
parent
f817acf963
commit
0e45aa5997
|
@ -95,11 +95,13 @@ func (b *Block) Enabled() bool {
|
||||||
if b.Type == LineBreak {
|
if b.Type == LineBreak {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, segment := range b.Segments {
|
for _, segment := range b.Segments {
|
||||||
if segment.Enabled {
|
if segment.Enabled {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +109,7 @@ func (b *Block) setEnabledSegments() {
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
wg.Add(len(b.Segments))
|
wg.Add(len(b.Segments))
|
||||||
defer wg.Wait()
|
defer wg.Wait()
|
||||||
|
|
||||||
for _, segment := range b.Segments {
|
for _, segment := range b.Segments {
|
||||||
go func(s *Segment) {
|
go func(s *Segment) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
|
@ -115,13 +115,25 @@ func (e *Engine) pwd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Engine) newline() {
|
func (e *Engine) newline() {
|
||||||
|
defer func() {
|
||||||
|
e.currentLineLength = 0
|
||||||
|
}()
|
||||||
|
|
||||||
// WARP terminal will remove \n from the prompt, so we hack a newline in
|
// WARP terminal will remove \n from the prompt, so we hack a newline in
|
||||||
if e.isWarp() {
|
if e.isWarp() {
|
||||||
e.write(e.Writer.LineBreak())
|
e.write(e.Writer.LineBreak())
|
||||||
} else {
|
return
|
||||||
e.write("\n")
|
|
||||||
}
|
}
|
||||||
e.currentLineLength = 0
|
|
||||||
|
// TCSH needs a space before the LITERAL newline character or it will not render correctly
|
||||||
|
// don't ask why, it be like that sometimes.
|
||||||
|
// https://unix.stackexchange.com/questions/99101/properly-defining-a-multi-line-prompt-in-tcsh#comment1342462_322189
|
||||||
|
if e.Env.Shell() == shell.TCSH {
|
||||||
|
e.write(` \n`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
e.write("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Engine) isWarp() bool {
|
func (e *Engine) isWarp() bool {
|
||||||
|
|
Loading…
Reference in a new issue