diff --git a/plover_console_ui/layout.py b/plover_console_ui/layout.py index deb0a42..36b8be3 100644 --- a/plover_console_ui/layout.py +++ b/plover_console_ui/layout.py @@ -104,18 +104,20 @@ def on_add_translation(self, engine): def scroll_amount(self): # magic number: top frame + bottom frame + prompt line + status line - return get_app().output.get_size().rows - 4 + console_size = get_app().output.get_size().rows - 4 + + return console_size * 2//3 def scroll_up(self): doc = self.console.body.document row = doc.cursor_position_row - window_size = self.scroll_amount() + amount = self.scroll_amount() - row -= window_size + row -= amount if doc.on_last_line: # first scroll won't move it - row -= window_size + row -= amount # don't over-scroll row = row if row >= 0 else 0 @@ -125,13 +127,13 @@ def scroll_up(self): def scroll_down(self): doc = self.console.body.document row = doc.cursor_position_row - window_size = self.scroll_amount() + amount = self.scroll_amount() - row += window_size + row += amount if doc.on_first_line: # first scroll won't move it - row += window_size + row += amount new_pos = doc.translate_row_col_to_index(row=row, col=0) self.console.body.document = Document(doc.text, cursor_position=new_pos) diff --git a/plover_console_ui/notification.py b/plover_console_ui/notification.py index 72219e4..d54b9fb 100644 --- a/plover_console_ui/notification.py +++ b/plover_console_ui/notification.py @@ -1,11 +1,10 @@ -from plover import log -from plover.log import logging +from plover.log import logging, LOG_FORMAT class ConsoleNotificationHandler(logging.Handler): """ Handler using console to show messages. """ - def __init__(self): + def __init__(self, format=LOG_FORMAT): super().__init__() self.output = None self.setFormatter(logging.Formatter(format)) diff --git a/setup.cfg b/setup.cfg index 1d0a57c..3764209 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = plover_console_ui -version = 1.1.2 +version = 1.1.3 description = Text User Interface for Plover long_description = file: README.rst author = Seth Rider