Skip to content

Commit

Permalink
bug: set newline based on prompt mode
Browse files Browse the repository at this point in the history
improve tmux display when using zsh mode
  • Loading branch information
NonLogicalDev committed Apr 12, 2023
1 parent 825f496 commit 0b51e07
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 5 additions & 7 deletions cmd/goprompt/cmdRender.go
Original file line number Diff line number Diff line change
@@ -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,13 +60,16 @@ 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
yellowC = color.Yellow.Render
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
}
2 changes: 0 additions & 2 deletions plugin/zsh/prompt_asynczle_setup.zsh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0b51e07

Please sign in to comment.