mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-22 03:57:30 +03:00
Get it working even with 2 row windows assuming they are wide enough to fit the title on a single line
This commit is contained in:
parent
dd72deb546
commit
17e31565e2
@ -174,8 +174,9 @@ def draw_screen(self) -> None:
|
||||
self.print(end='\r\n'*y)
|
||||
if self.cli_opts.message:
|
||||
y += self.draw_long_text(self.cli_opts.message)
|
||||
self.print()
|
||||
y += 1
|
||||
if self.screen_size.rows > 2:
|
||||
self.print()
|
||||
y += 1
|
||||
if self.cli_opts.type == 'yesno':
|
||||
self.draw_yesno(y)
|
||||
else:
|
||||
@ -187,11 +188,11 @@ def draw_choice(self, y: int) -> None:
|
||||
current_ranges: Dict[str, int] = {}
|
||||
width = self.screen_size.cols - 2
|
||||
|
||||
def commit_line() -> None:
|
||||
def commit_line(end: str = '\r\n') -> None:
|
||||
nonlocal current_line, y
|
||||
extra = (width - wcswidth(current_line)) // 2
|
||||
x = extra + 1
|
||||
self.print(' ' * x + current_line)
|
||||
self.print(' ' * x + current_line, end=end)
|
||||
for letter, sz in current_ranges.items():
|
||||
self.clickable_ranges[letter] = Range(x, x + sz - 3, y)
|
||||
x += sz
|
||||
@ -210,7 +211,7 @@ def commit_line() -> None:
|
||||
current_line += text
|
||||
current_ranges[letter] = sz
|
||||
if current_line:
|
||||
commit_line()
|
||||
commit_line(end='')
|
||||
|
||||
def draw_yesno(self, y: int) -> None:
|
||||
sep = ' ' * 3
|
||||
|
Loading…
Reference in New Issue
Block a user