Skip to content

Commit 0b51e07

Browse files
committed
bug: set newline based on prompt mode
improve tmux display when using zsh mode
1 parent 825f496 commit 0b51e07

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

cmd/goprompt/cmdRender.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ var (
2929
"prompt-mode", "normal",
3030
"mode of the prompt (normal, edit)",
3131
)
32-
33-
// DEPRECATED
34-
flgRNewline = cmdRender.PersistentFlags().String(
35-
"newline", "\n",
36-
"newline for the prompt",
37-
)
3832
)
3933

4034
func init() {
@@ -49,6 +43,7 @@ var (
4943
blueC = fmt.Sprint
5044
magentaC = fmt.Sprint
5145
normalC = fmt.Sprint
46+
newline = "\n"
5247
)
5348

5449
func setColorMode(mode string) {
@@ -65,13 +60,16 @@ func setColorMode(mode string) {
6560
blueC = wrapC("%F{blue}", "%F{reset}")
6661
magentaC = wrapC("%F{magenta}", "%F{reset}")
6762
greyC = wrapC("%F{black}", "%F{reset}")
63+
newline = "\n%{\r%}"
64+
6865
} else if mode == "ascii" {
6966
redC = color.Red.Render
7067
greenC = color.Green.Render
7168
yellowC = color.Yellow.Render
7269
blueC = color.Blue.Render
7370
magentaC = color.Magenta.Render
7471
greyC = color.Black.Render
72+
newline = "\n"
7573
}
7674
}
7775

@@ -260,7 +258,7 @@ func cmdRenderRun(_ *cobra.Command, _ []string) error {
260258
}
261259
promptLines = append(promptLines, promptMarker)
262260

263-
fmt.Print(strings.Join(promptLines, "\n"))
261+
fmt.Print(strings.Join(promptLines, newline))
264262

265263
return nil
266264
}

plugin/zsh/prompt_asynczle_setup.zsh

-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ __async_prompt_render() {
6565
#-------------------------------------------------------------------------------
6666

6767
__prompt_rerender() {
68-
local BR=$__ZSH_ASYNC_PROMPT_NEWLINE
69-
7068
PROMPT="$(printf "%s\n" "$ZSH_ASYNC_PROMPT_DATA" | __async_prompt_render) "
7169

7270
if [[ $PROMPT != $ZSH_ASYNC_PROMPT_LAST ]]; then

0 commit comments

Comments
 (0)