Pasting long lines to wrapped view inserts unwanted newline characters on linux
Author: asciimooCreated Feb 7, 2017Updated Sep 22, 2023
Labelsbug
First of all, thanks the great project. It makes UI creation easy and intuitive.
I have the following issue: if I paste a longer line than the view's width, it breaks the line as the image shows: 
It works as expected, when I type a long line instead of pasting.
simplified demo code to reproduce (paste 50*'a' to the view):
package main
import (
"log"
"github.com/jroimartin/gocui"
)
func main() {
g, err := gocui.NewGui(gocui.OutputNormal)
if err != nil {
log.Panicln(err)
}
defer g.Close()
g.Cursor = true
g.SetManagerFunc(layout)
g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit)
if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
log.Panicln(err)
}
}
func layout(g *gocui.Gui) error {
maxX, maxY := g.Size()
if v, err := g.SetView("hello", maxX/2-17, maxY/2-1, maxX/2+17, maxY/2+4); err != nil {
if err != gocui.ErrUnknownView {
return err
}
v.Editable = true
v.Wrap = true
g.SetCurrentView("hello")
}
return nil
}
func quit(g *gocui.Gui, v *gocui.View) error {
return gocui.ErrQuit
}Do you have any clue how could this be fixed/avoided?
Source: jroimartin/gocui