summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-07-03 00:21:13 +0200
committermathieui <mathieui@mathieui.net>2013-07-03 00:21:13 +0200
commitcae5f64931a75a9fdcb0ef523fc025f784e5a834 (patch)
treed5b5f40856bf85e02f4538994cfc657ef14effcc
parent697e311ce79f60b84c13a4a66b288dda0ab06fe8 (diff)
downloadpoezio-cae5f64931a75a9fdcb0ef523fc025f784e5a834.tar.gz
poezio-cae5f64931a75a9fdcb0ef523fc025f784e5a834.tar.bz2
poezio-cae5f64931a75a9fdcb0ef523fc025f784e5a834.tar.xz
poezio-cae5f64931a75a9fdcb0ef523fc025f784e5a834.zip
Move backwards in the input the same way we move forward (ref #2183)
-rw-r--r--src/windows.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/windows.py b/src/windows.py
index a270d732..0a31deed 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -1320,10 +1320,18 @@ class Input(Win):
"""
if reset:
self.reset_completion()
- if self.pos == self.width-1 and self.line_pos > 0:
- self.line_pos -= 1
+
+ if self.pos < (3*(self.width)//4) and self.line_pos > 0 and self.line_pos+self.pos-1<=len(self.text):
+ self.line_pos -= self.width//4
+ if self.line_pos < 0:
+ self.pos += (self.width//4) + self.line_pos - 1
+ self.line_pos = 0
+ else:
+ self.pos += self.width//4 - 1
elif self.pos >= 1:
self.pos -= 1
+ elif self.line_pos > 0:
+ self.line_pos -= 1
if jump and self.pos+self.line_pos >= 1 and self.text[self.pos+self.line_pos-1] == '\x19':
self.key_left()
elif reset: