Fix three bugs in mouse demo kitten DnD drop handling

Fixes #9631
This commit is contained in:
copilot-swe-agent[bot]
2026-03-09 09:43:36 +00:00
committed by Kovid Goyal
parent 3b17bf0b1a
commit 3d13cf1ca5
2 changed files with 3 additions and 3 deletions

View File

@@ -851,7 +851,7 @@ on_drop(GLFWwindow *window, GLFWDropEvent *ev) {
char buf[3072]; char buf[3072];
ssize_t ret = ev->read_data(window, ev, buf, sizeof(buf)); ssize_t ret = ev->read_data(window, ev, buf, sizeof(buf));
drop_dispatch_data(w, buf, ret); drop_dispatch_data(w, buf, ret);
if (ret <= 0) ev->finish_drop(window, GLFW_DRAG_OPERATION_GENERIC); if (ret < 0) ev->finish_drop(window, GLFW_DRAG_OPERATION_GENERIC);
} }
} }
} else { } else {

View File

@@ -296,9 +296,9 @@ func Run(args []string) (rc int, err error) {
case "M": case "M":
// Drop event from terminal // Drop event from terminal
dnd.dragging = false dnd.dragging = false
dnd.reset_drop_data()
mimes := strings.Fields(payload) mimes := strings.Fields(payload)
dnd.drop_mimes = mimes dnd.drop_mimes = mimes
dnd.reset_drop_data()
// Request data for text/plain first, then text/uri-list // Request data for text/plain first, then text/uri-list
for _, m := range mimes { for _, m := range mimes {
if m == "text/plain" { if m == "text/plain" {
@@ -357,7 +357,7 @@ func Run(args []string) (rc int, err error) {
draw_screen() draw_screen()
} else { } else {
// Decode base64 payload and append to buffer // Decode base64 payload and append to buffer
decoded, err := base64.StdEncoding.DecodeString(payload) decoded, err := base64.RawStdEncoding.DecodeString(payload)
if err == nil { if err == nil {
dnd.collect_buf.Write(decoded) dnd.collect_buf.Write(decoded)
} }