summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Pugnasse <david.pugnasse@gmail.com>2011-08-10 11:06:31 +0200
committerDavid Pugnasse <david.pugnasse@gmail.com>2011-08-10 11:06:31 +0200
commite7a32e04f095f195d5dcd2b929a63904a810ddfe (patch)
tree387fefe23d72516a12d2ed1518e3aa08cb9b3c77
parent71c57a7b150447e6120e0a7e2735dfe827975512 (diff)
parentc6e105e1c4fb59a5f35dae432340fdfb0304ba52 (diff)
downloadranger-e7a32e04f095f195d5dcd2b929a63904a810ddfe.tar.gz
Merge remote-tracking branch 'upstream/master' into rename
-rw-r--r--ranger/container/tags.py39
-rw-r--r--ranger/core/actions.py6
-rwxr-xr-xranger/data/scope.sh5
-rw-r--r--ranger/defaults/keys.py2
-rw-r--r--ranger/gui/widgets/pager.py2
5 files changed, 30 insertions, 24 deletions
diff --git a/ranger/container/tags.py b/ranger/container/tags.py
index ed015d16..c2fe3067 100644
--- a/ranger/container/tags.py
+++ b/ranger/container/tags.py
@@ -19,6 +19,7 @@ import string
 ALLOWED_KEYS = string.ascii_letters + string.digits + string.punctuation
 
 class Tags(object):
+	default_tag = '*'
 
 	def __init__(self, filename):
 
@@ -33,13 +34,13 @@ class Tags(object):
 		return item in self.tags
 
 	def add(self, *items, **others):
-		if 'mark' in others:
-			mark = others['mark']
+		if 'tag' in others:
+			tag = others['tag']
 		else:
-			mark = '*'
+			tag = self.defautag
 		self.sync()
 		for item in items:
-			self.tags[item] = mark
+			self.tags[item] = tag
 		self.dump()
 
 	def remove(self, *items):
@@ -52,17 +53,17 @@ class Tags(object):
 		self.dump()
 
 	def toggle(self, *items, **others):
-		if 'mark' in others:
-			mark = others['mark']
+		if 'tag' in others:
+			tag = others['tag']
 		else:
-			mark = '*'
+			tag = self.default_tag
 		self.sync()
 		for item in items:
 			try:
-				if item in self and self.tags[item] == mark:
+				if item in self and tag in (self.tags[item], self.default_tag):
 					del(self.tags[item])
 				else:
-					self.tags[item] = mark
+					self.tags[item] = tag
 			except KeyError:
 				pass
 		self.dump()
@@ -71,7 +72,7 @@ class Tags(object):
 		if item in self.tags:
 			return self.tags[item]
 		else:
-			return '*'
+			return self.default_tag
 
 	def sync(self):
 		try:
@@ -92,20 +93,24 @@ class Tags(object):
 			f.close()
 
 	def _compile(self, f):
-		for path, mark in self.tags.items():
-			if mark in ALLOWED_KEYS:
-				f.write('{0}:{1}\n'.format(mark, path))
+		for path, tag in self.tags.items():
+			if tag == self.default_tag:
+				# COMPAT: keep the old format if the default tag is used
+				f.write(path + '\n')
+			elif tag in ALLOWED_KEYS:
+				f.write('{0}:{1}\n'.format(tag, path))
 
 	def _parse(self, f):
 		result = dict()
 		for line in f:
 			line = line.strip()
 			if len(line) > 2 and line[1] == ':':
-				mark, path = line[0], line[2:]
-				if mark in ALLOWED_KEYS:
-					result[path] = mark
+				tag, path = line[0], line[2:]
+				if tag in ALLOWED_KEYS:
+					result[path] = tag
 			else:
-				result[line] = '*'
+				result[line] = self.default_tag
+
 		return result
 
 	def __nonzero__(self):
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 7bb80343..96a2ad38 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -430,7 +430,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	# Tags are saved in ~/.config/ranger/tagged and simply mark if a
 	# file is important to you in any context.
 
-	def tag_toggle(self, paths=None, value=None, movedown=None, mark='*'):
+	def tag_toggle(self, paths=None, value=None, movedown=None, tag=None):
 		if not self.tags:
 			return
 		if paths is None:
@@ -438,11 +438,11 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 		else:
 			tags = [realpath(path) for path in paths]
 		if value is True:
-			self.tags.add(*tags, mark=mark)
+			self.tags.add(*tags, tag=tag or self.tags.default_tag)
 		elif value is False:
 			self.tags.remove(*tags)
 		else:
-			self.tags.toggle(*tags, mark=mark)
+			self.tags.toggle(*tags, tag=tag or self.tags.default_tag)
 
 		if movedown is None:
 			movedown = len(tags) == 1 and paths is None
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 9f212cae..ca1f7e67 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -30,14 +30,15 @@ extension=$(echo "$path" | grep '\.' | grep -o '[^.]\+$')
 # Functions:
 # "have $1" succeeds if $1 is an existing command/installed program
 function have { type -P "$1" > /dev/null; }
-# "sucess" returns the exit code of the first program in the last pipe chain
+# "success" returns the exit code of the first program in the last pipe chain
 function success { test ${PIPESTATUS[0]} = 0; }
 
 case "$extension" in
 	# Archive extensions:
 	7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
 	rar|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
-		atool -l "$path" | head -n $maxln && exit 3
+		als "$path" | head -n $maxln
+		success && exit 0 || acat "$path" | head -n $maxln && exit 3
 		exit 1;;
 	# PDF documents:
 	pdf)
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 15aab318..cd1c5d07 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -160,7 +160,7 @@ map('L', fm.history_go(1))
 map('t', fm.tag_toggle())
 map('T', fm.tag_remove())
 for key in ALLOWED_TAGS_KEYS:
-		map('"' + key, fm.tag_toggle(mark=key))
+		map('"' + key, fm.tag_toggle(tag=key))
 
 map(' ', fm.mark(toggle=True))
 map('v', fm.mark(all=True, toggle=True))
diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py
index d851de3f..05485189 100644
--- a/ranger/gui/widgets/pager.py
+++ b/ranger/gui/widgets/pager.py
@@ -213,7 +213,7 @@ class Pager(Widget):
 						self.lines.append(l)
 						if len(self.lines) > n:
 							break
-				except UnicodeError:
+				except (UnicodeError, IOError):
 					pass
 				return self._get_line(n, attempt_to_read=False)
 			return ""
a3e3f0b ^
2b35fae ^
3e06ede ^
cdbc84b ^
338c083 ^
292ccc4 ^
d4b7a9a ^
10885d3 ^
1836b67 ^
ee8fb0c ^
7ab8c87 ^
1836b67 ^
ee8fb0c ^
7ab8c87 ^
2b35fae ^
72655f0 ^
ee8fb0c ^
df74b26 ^
0ea0343 ^
72655f0 ^
ee8fb0c ^
5871008 ^
cb9607c ^
fef6c5c ^


aa53e39 ^


ee8fb0c ^
7ab8c87 ^
72655f0 ^
ee8fb0c ^
7ab8c87 ^
3af6434 ^
85c9ebf ^
aa53e39 ^
9066ee2 ^
ee8fb0c ^
338c083 ^
352cae4 ^
ee8fb0c ^
1549faf ^
7ab8c87 ^

1549faf ^
ee8fb0c ^
42fd392 ^

ee8fb0c ^
df74b26 ^
7ab8c87 ^

df74b26 ^
ee8fb0c ^
7ab8c87 ^
45aea23 ^
ee8fb0c ^
338c083 ^
1549faf ^
ee8fb0c ^
a92cf49 ^
8dc8605 ^
ee8fb0c ^
df74b26 ^
7ab8c87 ^

1549faf ^
ee8fb0c ^
7ab8c87 ^
daae3bb ^
ee8fb0c ^
3e06ede ^
7ab8c87 ^

4bb89e2 ^
ee8fb0c ^
7ab8c87 ^
2b35fae ^
0c3544d ^
ee8fb0c ^
338c083 ^
0e5c819 ^
ee8fb0c ^
5871008 ^
4bd0d33 ^
ee8fb0c ^
338c083 ^
0c3544d ^
7ab8c87 ^
dc5c070 ^
7e98db2 ^

bced907 ^
60b3dce ^
21bd90d ^
c8f96b5 ^
4bb89e2 ^
c8f96b5 ^



c7da124 ^


c8f96b5 ^

124866e ^







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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153