summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-08-25 03:11:41 +0200
committerhut <hut@lavabit.com>2010-08-25 03:11:41 +0200
commite8b3ae51480ac217c2f064704902ff2f28b9f635 (patch)
treeac0932d087a100e329fb048ef083309b787c59f9
parent89f453db286f648dcaf498c32ac37d67ccd90e18 (diff)
downloadranger-e8b3ae51480ac217c2f064704902ff2f28b9f635.tar.gz
widgets.console: improved delete_word()
-rw-r--r--ranger/gui/widgets/console.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index ff8d137a..85b92548 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -20,6 +20,7 @@ commands, searching and executing files.
 
 import string
 import curses
+import re
 from collections import deque
 
 from . import Widget
@@ -258,15 +259,15 @@ class Console(Widget):
 		self.on_line_change()
 
 	def delete_word(self):
-		self.tab_deque = None
-		try:
-			i = self.line.rindex(' ', 0, self.pos - 1) + 1
-			self.line = self.line[:i] + self.line[self.pos:]
+		if self.line:
+			self.tab_deque = None
+			i = len(self.line) - 2
+			while i >= 0 and re.match(r'[\w\d]', self.line[i], re.U):
+				i -= 1
+			self.copy = self.line[i + 1:]
+			self.line = self.line[:i + 1]
 			self.pos = len(self.line)
-		except ValueError:
-			self.line = ''
-			self.pos = 0
-		self.on_line_change()
+			self.on_line_change()
 
 	def delete(self, mod):
 		self.tab_deque = None
2016-10-08 10:52:58 -0700 committer Kartik K. Agaram <vc@akkartik.com> 2016-10-08 10:53:06 -0700 3483' href='/akkartik/mu/commit/factorial.mu?h=hlt&id=9458918f9eb88817e6b58e6e475597f8d60ecc40'>9458918f ^
ce87c19e ^
1ead3562 ^
08b48a8d ^
c1d92c9d ^
192d59d3 ^

32241605 ^
b96af395 ^
08b48a8d ^
b96af395 ^


192d59d3 ^
b96af395 ^
bafc7192 ^
b96af395 ^


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