summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-01-12 07:13:02 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-01-12 07:13:02 +0100
commitfce9a60f9a4b7ff7273e3351336ef5e268178ff3 (patch)
treea9c619e516c8dd509b910c2d6c5246a53193491e /src
parent469bbd29006cdf660e7a2deaf171ec71c1f1c031 (diff)
downloadpoezio-fce9a60f9a4b7ff7273e3351336ef5e268178ff3.tar.gz
poezio-fce9a60f9a4b7ff7273e3351336ef5e268178ff3.tar.bz2
poezio-fce9a60f9a4b7ff7273e3351336ef5e268178ff3.tar.xz
poezio-fce9a60f9a4b7ff7273e3351336ef5e268178ff3.zip
Fix M-b and M-f, fixed #2102
Diffstat (limited to 'src')
-rw-r--r--src/core.py1
-rw-r--r--src/tabs.py4
-rw-r--r--src/windows.py19
3 files changed, 11 insertions, 13 deletions
diff --git a/src/core.py b/src/core.py
index 47ef1696..53728a5b 100644
--- a/src/core.py
+++ b/src/core.py
@@ -611,7 +611,6 @@ class Core(object):
if isinstance(self.current_tab(), tabs.RosterInfoTab):
self.refresh_window()
-
def full_screen_redraw(self):
"""
Completely erase and redraw the screen
diff --git a/src/tabs.py b/src/tabs.py
index e3418491..d1feffbb 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -37,6 +37,7 @@ import curses
import difflib
import shlex
import text_buffer
+import string
from sleekxmpp.xmlstream.stanzabase import JID
from config import config
@@ -230,8 +231,7 @@ class ChatTab(Tab):
Complete the input with words recently said
"""
# build the list of the recent words
- char_we_dont_want = [',', '(', ')', '.', '"', '\'', ' ', # The last one is nbsp
- '’', '“', '”', ':', ';', '[', ']', '{', '}']
+ char_we_dont_want = string.punctuation+' '
words = list()
for msg in self._room.messages[:-40:-1]:
if not msg:
diff --git a/src/windows.py b/src/windows.py
index 0c97a8db..d2080b0b 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -33,6 +33,7 @@ locale.setlocale(locale.LC_ALL, '')
import shlex
import curses
+import string
from config import config
from threading import Lock
@@ -714,11 +715,10 @@ class Input(Win):
"""
if not len(self.text) or self.pos == 0:
return
- previous_space = self.text[:self.pos+self.line_pos].rfind(' ')
- if previous_space == -1:
- previous_space = 0
- diff = self.pos+self.line_pos-previous_space
- for i in range(diff):
+ separators = string.punctuation+' '
+ while self.pos > 0 and self.text[self.pos+self.line_pos-1] in separators:
+ self.key_left()
+ while self.pos > 0 and self.text[self.pos+self.line_pos-1] not in separators:
self.key_left()
return True
@@ -728,11 +728,10 @@ class Input(Win):
"""
if len(self.text) == self.pos+self.line_pos or not len(self.text):
return
- next_space = self.text.find(' ', self.pos+self.line_pos+1)
- if next_space == -1:
- next_space = len(self.text)
- diff = next_space - (self.pos+self.line_pos)
- for i in range(diff):
+ separators = string.punctuation+' '
+ while len(self.text) != self.pos+self.line_pos and self.text[self.pos+self.line_pos] in separators:
+ self.key_right()
+ while len(self.text) != self.pos+self.line_pos and self.text[self.pos+self.line_pos] not in separators:
self.key_right()
return True