summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-03-23 18:32:47 +0100
committerhut <hut@lavabit.com>2010-03-24 04:14:55 +0100
commit3937f01085b05b486a597cd6865ca49a5af2a1e4 (patch)
tree7d93230c5eaf06b1940eb3191a4ff2aff7479f86 /ranger
parentcec158dac22bc14dd298b8136ab50b6e4e9ced4e (diff)
downloadranger-3937f01085b05b486a597cd6865ca49a5af2a1e4.tar.gz
main: updated
Diffstat (limited to 'ranger')
-rw-r--r--ranger/__main__.py21
-rw-r--r--ranger/core/fm.py5
2 files changed, 17 insertions, 9 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py
index 23491c28..bd01bf4a 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -40,8 +40,7 @@ def parse_arguments():
 			help="activate debug mode")
 
 	parser.add_option('-c', '--clean', action='store_true',
-			help="don't touch/require any config files. " \
-				"This will disable certain features. (tagging, bookmarks)")
+			help="don't touch/require any config files. ")
 
 	parser.add_option('-r', '--confdir', dest='confdir', type='string',
 			default=DEFAULT_CONFDIR,
@@ -87,7 +86,7 @@ def main():
 		sys.exit(1)
 
 	from signal import signal, SIGINT
-	from locale import setlocale, LC_ALL
+	from locale import getdefaultlocale, setlocale, LC_ALL
 
 	import ranger
 	from ranger.ext import curses_interrupt_handler
@@ -97,16 +96,20 @@ def main():
 	from ranger.gui.defaultui import DefaultUI as UI
 	from ranger.fsobject.file import File
 
-	try:
-		setlocale(LC_ALL, 'en_US.utf8')
-	except:
-		pass
-
-	curses_interrupt_handler.install_interrupt_handler()
+	# Ensure that a utf8 locale is set.
+	if getdefaultlocale()[1] not in ('utf8', 'UTF-8'):
+		for locale in ('en_US.utf8', 'en_US.UTF-8'):
+			try: setlocale(LC_ALL, locale)
+			except: pass  #sometimes there is none available though...
+	else:
+		setlocale(LC_ALL, '')
 
 	arg = parse_arguments()
 	ranger.arg = arg
 
+	if not ranger.arg.debug:
+		curses_interrupt_handler.install_interrupt_handler()
+
 	SettingsAware._setup()
 
 	# Initialize objects
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index d6822940..ba64b5bf 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -142,6 +142,11 @@ class FM(Actions):
 					gc_tick = 0
 					env.garbage_collect()
 
+		except KeyboardInterrupt:
+			# this only happens in --debug mode. By default, interrupts
+			# are caught in curses_interrupt_handler
+			raise SystemExit  
+
 		finally:
 			bookmarks.remember(env.cwd)
 			bookmarks.save()