move cursor to top after search, prompt_input method
This commit is contained in:
15
rtv/page.py
15
rtv/page.py
@@ -5,7 +5,7 @@ import sys
|
||||
import praw.errors
|
||||
|
||||
from .helpers import clean
|
||||
from .curses_helpers import Color, show_notification, show_help
|
||||
from .curses_helpers import Color, show_notification, show_help, text_input
|
||||
|
||||
__all__ = ['Navigator']
|
||||
|
||||
@@ -226,6 +226,19 @@ class BasePage(object):
|
||||
except praw.errors.LoginOrScopeRequired:
|
||||
show_notification(self.stdscr, ['Login to vote'])
|
||||
|
||||
def prompt_input(self, prompt):
|
||||
"""Prompt the user for input"""
|
||||
attr = curses.A_BOLD | Color.CYAN
|
||||
n_rows, n_cols = self.stdscr.getmaxyx()
|
||||
self.stdscr.addstr(n_rows - 1, 0, prompt, attr)
|
||||
self.stdscr.refresh()
|
||||
window = self.stdscr.derwin(1, n_cols - len(prompt),
|
||||
n_rows - 1, len(prompt))
|
||||
window.attrset(attr)
|
||||
|
||||
out = text_input(window)
|
||||
return out
|
||||
|
||||
def draw(self):
|
||||
|
||||
n_rows, n_cols = self.stdscr.getmaxyx()
|
||||
|
||||
Reference in New Issue
Block a user