summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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()
almost working implementaiton' href='/akspecs/ranger/commit/test/tc_direction.py?h=v1.2.0&id=447cbcd65588eafdb85b407750602c0fdd591ef4'>447cbcd6 ^
7a2665c2 ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88