Refactor dnd kitten: track num_dropped_files instead of data_has_been_dropped

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/84513fee-68de-4504-b41b-e8643e0ea585

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-18 08:44:07 +00:00
committed by GitHub
parent 6da5bae945
commit 7af3f4ee83
3 changed files with 25 additions and 6 deletions

View File

@@ -5,6 +5,7 @@ import (
"strings"
"github.com/kovidgoyal/kitty/tools/tui/loop"
"github.com/kovidgoyal/kitty/tools/utils"
"github.com/kovidgoyal/kitty/tools/wcswidth"
)
@@ -107,8 +108,9 @@ func (dnd *dnd) render_screen() error {
next_line()
}
if dnd.allow_drops {
if dnd.data_has_been_dropped {
render_paragraph(`Data has been successfully dropped. You can drop more data or press Esc to quit.`)
if dnd.num_dropped_files > 0 {
noun := utils.IfElse(dnd.num_dropped_files == 1, "file", "files")
render_paragraph(fmt.Sprintf(`%d %s %s been dropped in the last drop event. You can drop more data or press Esc to quit.`, dnd.num_dropped_files, noun, utils.IfElse(dnd.num_dropped_files == 1, "has", "have")))
} else {
render_paragraph(`Drag some data from another application into this window to transfer the files here.`)
}