mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-16 21:45:03 +02:00
unicode-input: Fix single column rendering of table
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"unicode"
|
||||
|
||||
"kitty/tools/cli"
|
||||
"kitty/tools/tty"
|
||||
"kitty/tools/tui"
|
||||
"kitty/tools/tui/loop"
|
||||
"kitty/tools/tui/readline"
|
||||
@@ -250,6 +251,8 @@ func (self *handler) update_codepoints() {
|
||||
}
|
||||
}
|
||||
|
||||
var debugprintln = tty.DebugPrintln
|
||||
|
||||
func (self *handler) update_current_char() {
|
||||
self.update_codepoints()
|
||||
self.current_char = InvalidChar
|
||||
|
||||
@@ -194,8 +194,11 @@ func (self *table) layout(rows, cols int) string {
|
||||
}
|
||||
col_width := longest + 2
|
||||
col_width = utils.Min(col_width, 40)
|
||||
space_for_desc = col_width - 2 - idx_size - 4
|
||||
self.num_cols = utils.Max(cols/col_width, 1)
|
||||
if self.num_cols == 1 {
|
||||
col_width = cols
|
||||
}
|
||||
space_for_desc = col_width - 2 - idx_size - 4
|
||||
self.num_rows = rows
|
||||
rows_left := rows
|
||||
skip_scroll := self.scroll_rows * self.num_cols
|
||||
@@ -207,7 +210,7 @@ func (self *table) layout(rows, cols int) string {
|
||||
}
|
||||
cell(i, cd)
|
||||
output.WriteString(" ")
|
||||
if i > 0 && (i+1)%self.num_cols == 0 {
|
||||
if self.num_cols == 1 || (i > 0 && (i+1)%self.num_cols == 0) {
|
||||
rows_left -= 1
|
||||
if rows_left == 0 {
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user