about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-02-15 01:06:49 +0100
committerhut <hut@lavabit.com>2010-02-15 01:14:37 +0100
commitb624bd941a381448261945ad94a25619b46552d4 (patch)
tree2a6bf4fa0c128d29e136e33f5084a2881ec548f2
parentb62924d97bcc8416a06ddb848f7cf1a745339346 (diff)
downloadranger-b624bd941a381448261945ad94a25619b46552d4.tar.gz
ui: catching exception from curs_set
it can be thrown if the terminal does not support cursor settings
-rw-r--r--TODO2
-rw-r--r--ranger/gui/ui.py10
-rw-r--r--ranger/gui/widgets/console.py10
3 files changed, 18 insertions, 4 deletions
diff --git a/TODO b/TODO
index fe08e314..3c106aa7 100644
--- a/TODO
+++ b/TODO
@@ -44,6 +44,7 @@ General
    ( ) #57  10/01/30  warn before deleting unseen marked files
    (X) #58  10/02/04  change the title of the terminal
    (X) #61  10/02/09  show sum of size of marked files
+   ( ) #63  10/02/15  limit filesize in previews
 
 
 Bugs
@@ -62,6 +63,7 @@ Bugs
    ( ) #52  10/01/23  special characters in tab completion
    (X) #54  10/01/23  max_dirsize_for_autopreview not working
    ( ) #60  10/02/05  utf support improvable
+   (X) #62  10/02/15  curs_set can raise an exception
 
 
 Ideas
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index c2dfd0e0..9ef2e344 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -52,7 +52,10 @@ class UI(DisplayableContainer):
 		curses.cbreak()
 		curses.noecho()
 		curses.halfdelay(20)
-		curses.curs_set(int(bool(self.settings.show_cursor)))
+		try:
+			curses.curs_set(int(bool(self.settings.show_cursor)))
+		except:
+			pass
 		curses.start_color()
 		curses.use_default_colors()
 
@@ -79,7 +82,10 @@ class UI(DisplayableContainer):
 		self.win.keypad(0)
 		curses.nocbreak()
 		curses.echo()
-		curses.curs_set(1)
+		try:
+			curses.curs_set(1)
+		except:
+			pass
 		curses.mousemask(0)
 		curses.endwin()
 
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 3dfa0ce7..2d542182 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -89,7 +89,10 @@ class Console(Widget):
 		cls = mode_to_class(mode)
 
 		if self.last_cursor_mode is None:
-			self.last_cursor_mode = curses.curs_set(1)
+			try:
+				self.last_cursor_mode = curses.curs_set(1)
+			except:
+				pass
 		self.mode = mode
 		self.__class__ = cls
 		self.history = self.histories[DEFAULT_HISTORY]
@@ -105,7 +108,10 @@ class Console(Widget):
 
 	def close(self):
 		if self.last_cursor_mode is not None:
-			curses.curs_set(self.last_cursor_mode)
+			try:
+				curses.curs_set(self.last_cursor_mode)
+			except:
+				pass
 			self.last_cursor_mode = None
 		self.add_to_history()
 		self.tab_deque = None