Open yurenchen000 opened 2 months ago
On Linux, if the path contains spaces, the dragged path will be similar to '/tmp/12 3'
On Linux, if the path contains spaces, the dragged path will be similar to
'/tmp/12 3'
if the file is /tmp/12' 3
(contains both space and ')
current parser may not work
Which Linux and Terminal would be like this? We only deal with real issues, not imaginary ones.
it's
trzsz go 1.1.8
offical release binary got the same result)test files (one file at a time):
/run/test/temp/12 3
failed/run/test/temp/12 3'
failed/run/test/temp/123
successMaybe https://github.com/google/shlex can support it.
Maybe https://github.com/google/shlex can support it.
Agree.
I think it follows shell quoting when drag files to warp terminal
(only tested with warp 0.2024.09.10.08.02.stable
, ubuntu 22
)
shlex.Split()
do it well
Test code:
// string got from warp terminal when drag files
str := `/run/test/temp/22\ 3 /run/test/temp/32\ 3\' /run/test/temp/123`
// try to split and decode it
arr, err := shlex.Split(str)
fmt.Println("s1:", str)
fmt.Printf("ss: %#v\n", arr)
Result is as expected.
s1: /run/test/temp/22\ 3 /run/test/temp/32\ 3\' /run/test/temp/123
ss: []string{"/run/test/temp/22 3", "/run/test/temp/32 3'", "/run/test/temp/123"}
on linux, if a file path is
/tmp/12' 3'
it seems not safe to encode/decode with current scheme?https://github.com/trzsz/trzsz-go/blob/5622a20/trzsz/drag.go#L73 //I noticed the drag detect logic when I try to adapting to a vte-based terminal (terminator or gnome-terminal)