fix: do not use raw TAB_WIN in bookmarks wins

(wth)
This commit is contained in:
mathieui 2021-03-25 22:11:49 +01:00
parent 43d84a2288
commit 2c12a598aa
2 changed files with 4 additions and 7 deletions

View file

@ -36,8 +36,7 @@ class BookmarksTab(Tab):
self.header_win = windows.ColumnHeaderWin(
['name', 'room@server/nickname', 'password', 'autojoin',
'storage'])
self.bookmarks_win = windows.BookmarksWin(
self.bookmarks, self.height - 4, self.width, 1, 0)
self.bookmarks_win = windows.BookmarksWin(self.bookmarks)
self.help_win = windows.HelpText('Ctrl+Y: save, Ctrl+G: cancel, '
'↑↓: change lines, tab: change '
'column, M-a: add bookmark, C-k'

View file

@ -155,8 +155,8 @@ class BookmarksWin(Win):
__slots__ = ('scroll_pos', '_current_input', 'current_horizontal_input',
'_bookmarks', 'lines')
def __init__(self, bookmarks: BookmarkList, height: int, width: int, y: int, x: int) -> None:
self._win = base_wins.TAB_WIN.derwin(height, width, y, x)
def __init__(self, bookmarks: BookmarkList) -> None:
Win.__init__(self)
self.scroll_pos = 0
self._current_input = 0
self.current_horizontal_input = 0
@ -214,9 +214,7 @@ class BookmarksWin(Win):
return bm
def resize(self, height: int, width: int, y: int, x: int) -> None:
self.height = height
self.width = width
self._win = base_wins.TAB_WIN.derwin(height, width, y, x)
super().resize(height, width, y, x)
# Adjust the scroll position, if resizing made the window too small
# for the cursor to be visible
while self.current_input - self.scroll_pos > self.height - 1: