From f9a2a981b463b7ce36e3318b55d8227cee107e47 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Sun, 29 May 2022 00:18:03 -0400 Subject: [PATCH] fix: revert "fix: multiline cursor redraw" This reverts commit 1339dc4a2f2e1ecfca4289f799631ab2cd337769. this caused a few issues, including history search messing up previous lines what this commit was trying to fix is unimportant anyway --- readline/line.go | 1 - readline/prompt.go | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/readline/line.go b/readline/line.go index 3dfa7c4..974a34d 100644 --- a/readline/line.go +++ b/readline/line.go @@ -45,7 +45,6 @@ func (rl *Instance) echo() { print(seqClearScreenBelow) // Print the prompt - rl.promptInPlace("") print(string(rl.realPrompt)) // Assemble the line, taking virtual completions into account diff --git a/readline/prompt.go b/readline/prompt.go index abda175..699abec 100644 --- a/readline/prompt.go +++ b/readline/prompt.go @@ -73,7 +73,8 @@ func (rl *Instance) RefreshPromptLog(log string) (err error) { return } -func (rl *Instance) promptInPlace(prompt string) { +// RefreshPromptInPlace - Refreshes the prompt in the very same place he is. +func (rl *Instance) RefreshPromptInPlace(prompt string) (err error) { // We adjust cursor movement, depending on which mode we're currently in. // Prompt data intependent if !rl.modeTabCompletion { @@ -90,11 +91,15 @@ func (rl *Instance) promptInPlace(prompt string) { rl.SetPrompt(prompt) } + if rl.Multiline { + rl.tcUsedY += 1 + } + // Clear the input line and everything below print(seqClearLine) moveCursorUp(rl.infoY + rl.tcUsedY) moveCursorBackwards(GetTermWidth()) - print("\r" + seqClearScreenBelow) + print("\r\n" + seqClearScreenBelow) // Add a new line if needed if rl.Multiline { @@ -103,11 +108,8 @@ func (rl *Instance) promptInPlace(prompt string) { } else { fmt.Print(rl.mainPrompt) } -} -// RefreshPromptInPlace - Refreshes the prompt in the very same place he is. -func (rl *Instance) RefreshPromptInPlace(prompt string) (err error) { - rl.promptInPlace(prompt) + // Refresh the line rl.updateHelpers() return