summary refs log tree commit diff stats
path: root/ranger
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 /ranger
parentb62924d97bcc8416a06ddb848f7cf1a745339346 (diff)
downloadranger-b624bd941a381448261945ad94a25619b46552d4.tar.gz
ui: catching exception from curs_set
it can be thrown if the terminal does not support cursor settings
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/ui.py10
-rw-r--r--ranger/gui/widgets/console.py10
2 files changed, 16 insertions, 4 deletions
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