mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-20 15:12:37 +00:00
Fix hanging dnd kitten test
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
This commit is contained in:
parent
5bfb5659ba
commit
6adff8efff
1 changed files with 8 additions and 4 deletions
|
|
@ -19,10 +19,11 @@ func (r button_region) has(x, y int) bool {
|
|||
}
|
||||
|
||||
func truncate_at_space(text string, width int) (string, string) {
|
||||
truncated, p := wcswidth.TruncateToVisualLengthWithWidth(text, width)
|
||||
truncated := wcswidth.TruncateToVisualLength(text, width)
|
||||
if len(truncated) == len(text) {
|
||||
return text, ""
|
||||
}
|
||||
p := len(truncated)
|
||||
i := strings.LastIndexByte(truncated, ' ')
|
||||
if i > 0 && p-i < 12 {
|
||||
p = i + 1
|
||||
|
|
@ -33,9 +34,12 @@ func truncate_at_space(text string, width int) (string, string) {
|
|||
func paragraph_as_lines(text string, width int) (ans []string) {
|
||||
for text != "" {
|
||||
var line string
|
||||
if line, text = truncate_at_space(text, width); line != "" {
|
||||
ans = append(ans, line)
|
||||
if line, text = truncate_at_space(text, width); line == "" {
|
||||
// width too small to fit even a single character
|
||||
ans = append(ans, text)
|
||||
break
|
||||
}
|
||||
ans = append(ans, line)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -75,7 +79,7 @@ func (dnd *dnd) render_screen() error {
|
|||
sz, _ := lp.ScreenSize()
|
||||
next_line()
|
||||
next_line()
|
||||
overwrites := dnd.confirm_drop.overwrites[:min(int(sz.HeightCells)-y-1, len(dnd.confirm_drop.overwrites))]
|
||||
overwrites := dnd.confirm_drop.overwrites[:max(0, min(int(sz.HeightCells)-y-1, len(dnd.confirm_drop.overwrites)))]
|
||||
for _, x := range overwrites {
|
||||
lp.Println(x)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue