From 0bb7e10bf614cb289d04d1da0ee1480c2cb6795e Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 24 Oct 2011 01:46:07 +0200 Subject: gui.curses_shortcuts: Fix 97e724a3 for addstr() with one argument --- ranger/gui/curses_shortcuts.py | 18 ++++++++++-------- ranger/gui/widgets/console.py | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py index 4a3bb4b9..10a159a1 100644 --- a/ranger/gui/curses_shortcuts.py +++ b/ranger/gui/curses_shortcuts.py @@ -39,19 +39,21 @@ class CursesShortcuts(SettingsAware): try: self.win.addstr(*args) except: - try: - self.win.addstr(*_fix_surrogates(args)) - except: - pass + if len(args) > 1: + try: + self.win.addstr(*_fix_surrogates(args)) + except: + pass def addnstr(self, *args): try: self.win.addnstr(*args) except: - try: - self.win.addnstr(*_fix_surrogates(args)) - except: - pass + if len(args) > 2: + try: + self.win.addnstr(*_fix_surrogates(args)) + except: + pass def addch(self, *args): try: diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 406a2fe9..2376ba5a 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -79,9 +79,9 @@ class Console(Widget): line = WideString(self.line) overflow = -self.wid + len(self.prompt) + len(line) + 1 if overflow > 0: - self.addstr(str(line[overflow:])) + self.addstr(0, len(self.prompt), str(line[overflow:])) else: - self.addstr(self.line) + self.addstr(0, len(self.prompt), self.line) def finalize(self): try: -- cgit 1.4.1-2-gfad0