Skip to content

Commit b20d43e

Browse files
committed
Fix the handling of paste.
1 parent 1af8717 commit b20d43e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

driver.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ func (d *driver) ApplyTextCommand(t TB, cmd string, args ...string) tea.Cmd {
462462
d.addMsg(tea.KeyMsg(tea.Key{Type: tea.KeyEnter}))
463463

464464
case "paste":
465-
d.assertArgc(t, args, 1)
466-
s, err := strconv.Unquote(args[0])
465+
arg := strings.Join(args, " ")
466+
s, err := strconv.Unquote(arg)
467467
if err != nil {
468468
t.Fatalf("%s: paste argment error: %v", d.pos, err)
469469
}

testdata/simple

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ TEA PRINT: {MODEL UPDATE}
7474
MODEL VIEW🛇
7575

7676
run trace=on
77-
paste "ab\ncd"
77+
paste "a b\nc d"
7878
----
79-
-- trace: before "paste \"ab\\ncd\""
79+
-- trace: before "paste \"a b\\nc d\""
8080
-- trace: after "paste"
8181
-- view:
8282
MODEL VIEW🛇
8383
-- trace: before finish
8484
-- view:
8585
MODEL VIEW🛇
8686
-- trace: processing 1 messages
87-
-- trace: msg tea.KeyMsg{Type:-1, Runes:[]int32{97, 98, 10, 99, 100}, Alt:false}
87+
-- trace: msg tea.KeyMsg{Type:-1, Runes:[]int32{97, 32, 98, 10, 99, 32, 100}, Alt:false}
8888
-- trace: processing 1 cmds
8989
-- trace: translated cmd: tea.printLineMessage
9090
-- trace: processing 1 messages

0 commit comments

Comments
 (0)