Address review comments: rename variable and improve comments

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/41b8254d-fc79-4f41-9775-67d1ddfceb5b

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-14 02:53:15 +00:00 committed by GitHub
parent 66dca3cde1
commit 8acb6e7ecb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -634,8 +634,8 @@ func (dnd *dnd) on_drop_move(cell_x, cell_y int, has_more bool, offered_mimes st
}
}
// Restrict to operations allowed by the drag source.
if sao := dnd.drop_status.source_allowed_ops; sao != 0 && dnd.drop_status.action != 0 {
if sao&dnd.drop_status.action == 0 {
if allowed := dnd.drop_status.source_allowed_ops; allowed != 0 && dnd.drop_status.action != 0 {
if allowed&dnd.drop_status.action == 0 {
dnd.drop_status.action = 0
dnd.drop_status.accepted_mimes = nil
}

View file

@ -210,14 +210,14 @@ def test_dnd_kitten_drop_allowed_ops(self):
self.wait_for_state('drop_action', GLFW_DRAG_OPERATION_COPY)
dnd_test_fake_drop_event(wid, False)
dnd_test_fake_drop_event(wid, False, mimes, move[0] + 1, move[1] + 1, 1)
self.wait_for_state('drop_action', 0) # GLFW_DRAG_OPERATION_NONE
self.wait_for_state('drop_action', 0) # GLFW_DRAG_OPERATION_NONE: source allows copy only, move box must reject
dnd_test_fake_drop_event(wid, False)
# allowed_ops=2 means move-only in kitten format
dnd_test_fake_drop_event(wid, False, mimes, move[0] + 1, move[1] + 1, 2)
self.wait_for_state('drop_action', GLFW_DRAG_OPERATION_MOVE)
dnd_test_fake_drop_event(wid, False)
dnd_test_fake_drop_event(wid, False, mimes, copy[0] + 1, copy[1] + 1, 2)
self.wait_for_state('drop_action', 0) # GLFW_DRAG_OPERATION_NONE
self.wait_for_state('drop_action', 0) # GLFW_DRAG_OPERATION_NONE: source allows move only, copy box must reject
dnd_test_fake_drop_event(wid, False)
# allowed_ops=3 means both copy and move allowed (default)
for b, expected in ((copy, GLFW_DRAG_OPERATION_COPY), (move, GLFW_DRAG_OPERATION_MOVE)):