[GH-ISSUE #133] InputField paste-buffer is very short #103

Closed
opened 2026-03-04 01:01:58 +03:00 by kerem · 5 comments
Owner

Originally created by @Lallassu on GitHub (Jun 13, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/133

When pasting text into a InputField it only takes the first 11 chars of the copy-buffer.

Tested in OSX.

Originally created by @Lallassu on GitHub (Jun 13, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/133 When pasting text into a InputField it only takes the first 11 chars of the copy-buffer. Tested in OSX.
kerem closed this issue 2026-03-04 01:01:58 +03:00
Author
Owner

@joegrasse commented on GitHub (Jun 13, 2018):

This is because of this issue.

<!-- gh-comment-id:396902149 --> @joegrasse commented on GitHub (Jun 13, 2018): This is because of this [issue](https://github.com/gdamore/tcell/issues/200).
Author
Owner

@rivo commented on GitHub (Jun 13, 2018):

Was going to say the same. I'm closing this issue then.

<!-- gh-comment-id:396992014 --> @rivo commented on GitHub (Jun 13, 2018): Was going to say the same. I'm closing this issue then.
Author
Owner

@alvarolm commented on GitHub (Sep 26, 2018):

in case anyone needs it, i leave a poor man fix, assuming the cursor is always at the end of the input text:

import (
	....

	"github.com/atotto/clipboard"
	"github.com/gdamore/tcell"
	"github.com/rivo/tview"
)

myinputfield.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
	switch event.Key() {
	case tcell.KeyCtrlV:
		// janky fix
		cb, err := clipboard.ReadAll()
		if err != nil {
			km.logger.Error().Msg("Couldn't get clipboard: " + err.Error())
			break
		}
		km.components.command.SetText(km.components.command.GetText() + cb)
	....
	}
}
<!-- gh-comment-id:424548054 --> @alvarolm commented on GitHub (Sep 26, 2018): in case anyone needs it, i leave a poor man fix, assuming the cursor is always at the end of the input text: ```go import ( .... "github.com/atotto/clipboard" "github.com/gdamore/tcell" "github.com/rivo/tview" ) myinputfield.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { switch event.Key() { case tcell.KeyCtrlV: // janky fix cb, err := clipboard.ReadAll() if err != nil { km.logger.Error().Msg("Couldn't get clipboard: " + err.Error()) break } km.components.command.SetText(km.components.command.GetText() + cb) .... } } ```
Author
Owner

@l0k18 commented on GitHub (Apr 28, 2019):

This bug is such a smelly one in the middle of a rose garden. The fix makes your app dependent on xsel being installed, on linux. I am forking tcell and tview because I need this working before halley's comet returns.

https://github.com/rivo/tcell/commits/master the tcell tview uses now has been untouched in over a year, and this is literally one character change to fix, and said tcell library has no issues either.

It's a very very nice library and I'm forking it but who doesn't need to paste 16+ character long strings on a regular basis these days?

<!-- gh-comment-id:487348337 --> @l0k18 commented on GitHub (Apr 28, 2019): This bug is such a smelly one in the middle of a rose garden. The fix makes your app dependent on `xsel` being installed, on linux. I am forking tcell and tview because I need this working before halley's comet returns. https://github.com/rivo/tcell/commits/master the tcell tview uses now has been untouched in over a year, and this is literally one character change to fix, and said tcell library has no issues either. It's a very very nice library and I'm forking it but who doesn't need to paste 16+ character long strings on a regular basis these days?
Author
Owner

@rivo commented on GitHub (May 14, 2019):

@l0k1verloren The repo you quoted is not the one tview depends on:

github.com/rivo/tview@cf9d115173/application.go (L6)

@gdamore still maintains tcell. It's probably better to direct any (constructive) feedback to the relevant issue for this: gdamore/tcell#200.

<!-- gh-comment-id:492317647 --> @rivo commented on GitHub (May 14, 2019): @l0k1verloren The repo you quoted is not the one `tview` depends on: https://github.com/rivo/tview/blob/cf9d1151736203cd42b67c554536559e2af885e1/application.go#L6 @gdamore still maintains [`tcell`](https://github.com/gdamore/tcell). It's probably better to direct any (constructive) feedback to the relevant issue for this: gdamore/tcell#200.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#103
No description provided.