summaryrefslogtreecommitdiff
path: root/poezio
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2019-10-26 21:34:28 +0200
committermathieui <mathieui@mathieui.net>2019-10-26 21:37:06 +0200
commit5e3f2ab19f36b86043f14abb20f5c170c3eb75a1 (patch)
tree71c8d4b6c47376ee603ff6699a179a31d365f679 /poezio
parent4703c8506a7483650d0237a5def29ceed79f0c4a (diff)
downloadpoezio-5e3f2ab19f36b86043f14abb20f5c170c3eb75a1.tar.gz
poezio-5e3f2ab19f36b86043f14abb20f5c170c3eb75a1.tar.bz2
poezio-5e3f2ab19f36b86043f14abb20f5c170c3eb75a1.tar.xz
poezio-5e3f2ab19f36b86043f14abb20f5c170c3eb75a1.zip
Fix #3511 (fix traceback on first bookmark added)
Diffstat (limited to 'poezio')
-rw-r--r--poezio/windows/bookmark_forms.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/poezio/windows/bookmark_forms.py b/poezio/windows/bookmark_forms.py
index 1e5cdfc6..28cab8ec 100644
--- a/poezio/windows/bookmark_forms.py
+++ b/poezio/windows/bookmark_forms.py
@@ -15,7 +15,7 @@ from poezio.bookmarks import Bookmark, BookmarkList
class BookmarkNameInput(FieldInput, Input):
- def __init__(self, field) -> None:
+ def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field)
Input.__init__(self)
self.text = field.name
@@ -30,7 +30,7 @@ class BookmarkNameInput(FieldInput, Input):
class BookmarkJIDInput(FieldInput, Input):
- def __init__(self, field) -> None:
+ def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field)
Input.__init__(self)
jid = safeJID(field.jid)
@@ -49,7 +49,7 @@ class BookmarkJIDInput(FieldInput, Input):
class BookmarkMethodInput(FieldInputMixin):
- def __init__(self, field) -> None:
+ def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field)
Win.__init__(self)
self.options = ('local', 'remote')
@@ -89,7 +89,7 @@ class BookmarkMethodInput(FieldInputMixin):
class BookmarkPasswordInput(FieldInput, Input):
- def __init__(self, field) -> None:
+ def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field)
Input.__init__(self)
self.text = field.password or ''
@@ -119,7 +119,7 @@ class BookmarkPasswordInput(FieldInput, Input):
class BookmarkAutojoinWin(FieldInputMixin):
- def __init__(self, field) -> None:
+ def __init__(self, field: Bookmark) -> None:
FieldInput.__init__(self, field)
Win.__init__(self)
self.last_key = 'KEY_RIGHT'
@@ -190,11 +190,13 @@ class BookmarksWin(Win):
BookmarkPasswordInput(bookmark),
BookmarkAutojoinWin(bookmark),
BookmarkMethodInput(bookmark)))
- self.lines[self.current_input][
- self.current_horizontal_input].set_color(
- get_theme().COLOR_NORMAL_TEXT)
+ if len(self.lines) > 1:
+ self.lines[self.current_input][
+ self.current_horizontal_input].set_color(
+ get_theme().COLOR_NORMAL_TEXT)
self.current_horizontal_input = 0
- self.current_input = len(self.lines) - 1
+ if len(self.lines) > 1:
+ self.current_input = len(self.lines) - 1
if self.current_input - self.scroll_pos > self.height - 1:
self.scroll_pos = self.current_input - self.height + 1
self.refresh()