From 0b51e07941043571c29f175ed70c74d8c39f5df4 Mon Sep 17 00:00:00 2001 From: Oleg Utkin Date: Wed, 12 Apr 2023 10:44:57 -0700 Subject: [PATCH] bug: set newline based on prompt mode improve tmux display when using zsh mode --- cmd/goprompt/cmdRender.go | 12 +++++------- plugin/zsh/prompt_asynczle_setup.zsh | 2 -- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cmd/goprompt/cmdRender.go b/cmd/goprompt/cmdRender.go index da3d397..be0ff22 100644 --- a/cmd/goprompt/cmdRender.go +++ b/cmd/goprompt/cmdRender.go @@ -29,12 +29,6 @@ var ( "prompt-mode", "normal", "mode of the prompt (normal, edit)", ) - - // DEPRECATED - flgRNewline = cmdRender.PersistentFlags().String( - "newline", "\n", - "newline for the prompt", - ) ) func init() { @@ -49,6 +43,7 @@ var ( blueC = fmt.Sprint magentaC = fmt.Sprint normalC = fmt.Sprint + newline = "\n" ) func setColorMode(mode string) { @@ -65,6 +60,8 @@ func setColorMode(mode string) { blueC = wrapC("%F{blue}", "%F{reset}") magentaC = wrapC("%F{magenta}", "%F{reset}") greyC = wrapC("%F{black}", "%F{reset}") + newline = "\n%{\r%}" + } else if mode == "ascii" { redC = color.Red.Render greenC = color.Green.Render @@ -72,6 +69,7 @@ func setColorMode(mode string) { blueC = color.Blue.Render magentaC = color.Magenta.Render greyC = color.Black.Render + newline = "\n" } } @@ -260,7 +258,7 @@ func cmdRenderRun(_ *cobra.Command, _ []string) error { } promptLines = append(promptLines, promptMarker) - fmt.Print(strings.Join(promptLines, "\n")) + fmt.Print(strings.Join(promptLines, newline)) return nil } diff --git a/plugin/zsh/prompt_asynczle_setup.zsh b/plugin/zsh/prompt_asynczle_setup.zsh index 9ebda10..8eb568c 100755 --- a/plugin/zsh/prompt_asynczle_setup.zsh +++ b/plugin/zsh/prompt_asynczle_setup.zsh @@ -65,8 +65,6 @@ __async_prompt_render() { #------------------------------------------------------------------------------- __prompt_rerender() { - local BR=$__ZSH_ASYNC_PROMPT_NEWLINE - PROMPT="$(printf "%s\n" "$ZSH_ASYNC_PROMPT_DATA" | __async_prompt_render) " if [[ $PROMPT != $ZSH_ASYNC_PROMPT_LAST ]]; then