mirror of
https://github.com/mark3labs/kit.git
synced 2026-06-14 03:30:26 +00:00
fix(ui): skip image preview when input width is too small
- Return 0 from thumbCols when width <= 6 so a full-size thumbnail is no longer rendered for tiny or uninitialized (width 0) terminals; the caller falls back to the text pill
This commit is contained in:
@@ -579,10 +579,10 @@ const (
|
||||
// thumbCols returns the thumbnail width in terminal cells given the current
|
||||
// input width, or 0 when there is no room to render a preview.
|
||||
func (s *InputComponent) thumbCols() int {
|
||||
cols := thumbMaxCols
|
||||
if s.width > 6 && s.width-6 < cols {
|
||||
cols = s.width - 6
|
||||
if s.width <= 6 {
|
||||
return 0
|
||||
}
|
||||
cols := min(thumbMaxCols, s.width-6)
|
||||
if cols < 1 {
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user