Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behaviour with multi-line and history #150

Open
Isolus opened this issue Nov 1, 2021 · 1 comment
Open

Weird behaviour with multi-line and history #150

Isolus opened this issue Nov 1, 2021 · 1 comment

Comments

@Isolus
Copy link

Isolus commented Nov 1, 2021

When I run the following minimal example on Manjaro Linux / xfce4-terminal (0.8.10) or on Mac OS X 10.14.6 / Terminal

package main

import "github.com/peterh/liner"

func main() {

	line := liner.NewLiner()
	defer line.Close()

	line.SetMultiLineMode(true)

	for {
		input, _ := line.Prompt("> ")
		line.AppendHistory(input)
		if input == "exit" {
			break
		}
	}

}

and enter a short line, a long line which extends to a second line and then recall the first line from history with the up key and press enter, there is an additional blank line (the one before the exit) which shouldn't be there.

> s=1
> s=fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
fff
> s=1

> exit

The prompt seems to jump one line up while going over the two line history entry which somehow creates the extra newline. If the multi line entry spans several lines you get even more blank lines.

@peterh
Copy link
Owner

peterh commented Nov 6, 2021

Ping @flisky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants