move cursor to top after search, prompt_input method

This commit is contained in:
Tobin
2015-03-31 13:24:33 -05:00
parent f9265fd33b
commit a1fdd2a93a
2 changed files with 22 additions and 24 deletions

View File

@@ -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()