-
Notifications
You must be signed in to change notification settings - Fork 31
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
Can't paste long strings into text-accepting widgets #14
Comments
This seems to be an issue in tcell - there are issues logged for tcell and for tview, a widget framework built on tcell: I'll figure out what to do for gowid - maybe fork tcell temporarily and use this patch: |
I've made a couple of PRs to tcell to try to address this and other pasting problems. From previous comments the author has made, he's very busy and tcell isn't paying the bills, so I'm not sure if there'll be a quick reply. I'll give it a short time, then maybe maintain a minor fork of tcell until the issue is resolved one way or another. |
In this fork https://github.com/zyedidia/tcell used by micro editor, there are a lots of commits for addressing pasting problems that can be useful. |
Thanks, this is interesting - it looks like the fork was made back in 2016! I wonder if the author tried to merge changes back upstream? Makes me wonder if this fork might be more fruitful than the original repo. Would you be interested in trying out the paste fixes I submitted upstream? I can describe how to adjust your go project to use the changes. Are you using go modules? |
Using I also tried
I think the |
Sorry @mdouchement I forgot there are gowid-side changes to make use of the tcell bundleevents branch. Could you pull from gcla/gowid and point your app at the new gowid bundleevents branch too? |
NP, it seems the compilation error remain:
Based on the commits' sha1, my require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/bep/debounce v1.2.0
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/gcla/gowid v1.0.1-0.20190530225931-1bb8b12f6450
github.com/gdamore/tcell v1.1.2
github.com/mdouchement/simple-argon2 v0.1.0
github.com/mdouchement/standardfile v0.2.0
github.com/pkg/errors v0.8.1
github.com/sanity-io/litter v1.1.0
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.3
github.com/stretchr/objx v0.2.0 // indirect
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5
golang.org/x/net v0.0.0-20190522155817-f3200d17e092 // indirect
golang.org/x/sys v0.0.0-20190531132440-69e3a3a65b5b // indirect
golang.org/x/tools v0.0.0-20190530215528-75312fb06703 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
)
replace github.com/gdamore/tcell => github.com/gcla/tcell v1.1.2-0.20190529031537-c0fec8904a79 |
Sorry to waste your time, there was a file I forgot to check in :-( It worked for me because I had a replace statement pointing to the changes on my local disk. I've pushed it now to gcla/tcell@bundleevents, along with another change to replace imports of gdamore/tcell with gcla/tcell. Just on the bundleevents branch of course, for the purposes of this experiment. |
The paste is faster than
|
Hi - trying to think what could be going wrong... Is unhandled() no longer called when you run your app? If it is called, could you print/log something like logrus.Infof("Event is %v of type %T", ev, ev) |
Here the result:
I've dig futher more and I found that the |
Yes, sounds like it might be that - tcell will be sending you *EventBundle events now, but if gowid is on the right branch, its HandleTCellEvent function should unpack *EventBundle into individual events like *EventKey, *EventMouse, and process them like normal. If you're somehow linking to the non-bundleevents version of gowid, it would log an unexpected event type, and not pass it on to your application. |
I just re-read your previous comment, and realized I'm probably wrong! Could you check to make sure you don't have any references in your source code to gdamore/tcell and and if you do to replace those with gcla/tcell? That would also be consistent with your hunch about type assertions and "replace". |
Ok, it works by importing |
The tcell author merged the PR for fixpastelimit: gdamore/tcell#280. I'm not yet sure what will happen to the bundlevents PR. I'll probably adjust the gcla/tcell fork so that it's up to date with respect to gdamore/tcell, then re-apply bundlevents on top. Just to let you know in case it causes problems for your application! I'll close this issue for now. |
e.g. run the editor example and paste a longish (> 10 characters) string using the mouse e.g. shift-right-click Paste in gnome terminal. Only the first few characters appear.
The text was updated successfully, but these errors were encountered: