Unexport IsPasting

Nothing outside gocui needs to know about pastes any more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-11-12 10:22:50 +01:00
co-authored by Claude Opus 5.5
parent c28e3576d1
commit 14a36053e9
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ func TestBlockingEvents_PastedKeysReplayedAsPasted(t *testing.T) {
g.EndBlockingEvents()
runQueuedWork(t, g)
assert.Empty(t, *fired)
assert.False(t, g.IsPasting)
assert.False(t, g.isPasting)
}
func TestBlockingEvents_NestsWithCounter(t *testing.T) {
+6 -4
View File
@@ -188,7 +188,9 @@ type Gui struct {
// If Mouse is true then mouse events will be enabled.
Mouse bool
IsPasting bool
// Whether a paste is in progress, between the terminal's events for its
// start and end
isPasting bool
// The text pasted so far into pasteView, a view with an OnPaste handler
pasteBuffer strings.Builder
@@ -1288,7 +1290,7 @@ func (g *Gui) handleEvent(ev *GocuiEvent) error {
case eventFocus:
return g.onFocus(ev)
case eventPaste:
g.IsPasting = ev.Start
g.isPasting = ev.Start
if !ev.Start {
return g.deliverPaste()
}
@@ -1805,11 +1807,11 @@ func (g *Gui) onKey(ev *GocuiEvent) error {
// in bracketed paste mode. Whatever I'm missing here, converting '\r'
// back to '\n' fixes pasting multi-line text from Ghostty, and doesn't
// seem harmful for other terminal emulators.
if g.IsPasting && ev.Key.Equals(NewKeyStrMod("j", ModCtrl)) {
if g.isPasting && ev.Key.Equals(NewKeyStrMod("j", ModCtrl)) {
ev.Key = NewKeyName(KeyEnter)
}
if g.IsPasting {
if g.isPasting {
if g.currentView != nil && g.currentView.OnPaste != nil {
g.collectPastedKey(g.currentView, ev.Key)
}
+1 -1
View File
@@ -44,7 +44,7 @@ func TestPasteIntoViewWithPasteHandler(t *testing.T) {
assert.Equal(t, []string{"a\n\n\tb"}, pasted)
assert.False(t, escPressed)
assert.Equal(t, "", v.TextArea.GetContent())
assert.False(t, g.IsPasting)
assert.False(t, g.isPasting)
}
func TestPasteIntoViewWithoutPasteHandler(t *testing.T) {