Switch to using goroutines rather than a select()

More complex code since now we have to synchronize between threads,
but a good way to teach myself more about goroutines.
This commit is contained in:
Kovid Goyal
2022-08-26 08:37:14 +05:30
parent ee12349a50
commit 4a49c3940a
5 changed files with 418 additions and 387 deletions

View File

@@ -70,9 +70,9 @@ func wrap_in_escape_code(data []byte) []byte {
const prefix = "\x1bP@kitty-cmd"
const suffix = "\x1b\\"
ans := make([]byte, len(prefix)+len(data)+len(suffix))
n := copy(ans, []byte(prefix))
n := copy(ans, prefix)
n += copy(ans[n:], data)
copy(ans[n:], []byte(suffix))
copy(ans[n:], suffix)
return ans
}