Simplify message formatting in render.go

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:46:34 +00:00 committed by GitHub
parent 7af3f4ee83
commit 858c453ae9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,7 +5,6 @@ import (
"strings"
"github.com/kovidgoyal/kitty/tools/tui/loop"
"github.com/kovidgoyal/kitty/tools/utils"
"github.com/kovidgoyal/kitty/tools/wcswidth"
)
@ -109,8 +108,13 @@ func (dnd *dnd) render_screen() error {
}
if dnd.allow_drops {
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")))
verb := "have"
noun := "files"
if dnd.num_dropped_files == 1 {
verb = "has"
noun = "file"
}
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, verb))
} else {
render_paragraph(`Drag some data from another application into this window to transfer the files here.`)
}