Commit fce9a60f authored by louiz’'s avatar louiz’

Fix M-b and M-f, fixed #2102

parent 469bbd29
...@@ -611,7 +611,6 @@ class Core(object): ...@@ -611,7 +611,6 @@ class Core(object):
if isinstance(self.current_tab(), tabs.RosterInfoTab): if isinstance(self.current_tab(), tabs.RosterInfoTab):
self.refresh_window() self.refresh_window()
def full_screen_redraw(self): def full_screen_redraw(self):
""" """
Completely erase and redraw the screen Completely erase and redraw the screen
......
...@@ -37,6 +37,7 @@ import curses ...@@ -37,6 +37,7 @@ import curses
import difflib import difflib
import shlex import shlex
import text_buffer import text_buffer
import string
from sleekxmpp.xmlstream.stanzabase import JID from sleekxmpp.xmlstream.stanzabase import JID
from config import config from config import config
...@@ -230,8 +231,7 @@ class ChatTab(Tab): ...@@ -230,8 +231,7 @@ class ChatTab(Tab):
Complete the input with words recently said Complete the input with words recently said
""" """
# build the list of the recent words # build the list of the recent words
char_we_dont_want = [',', '(', ')', '.', '"', '\'', ' ', # The last one is nbsp char_we_dont_want = string.punctuation+' '
'’', '“', '”', ':', ';', '[', ']', '{', '}']
words = list() words = list()
for msg in self._room.messages[:-40:-1]: for msg in self._room.messages[:-40:-1]:
if not msg: if not msg:
......
...@@ -33,6 +33,7 @@ locale.setlocale(locale.LC_ALL, '') ...@@ -33,6 +33,7 @@ locale.setlocale(locale.LC_ALL, '')
import shlex import shlex
import curses import curses
import string
from config import config from config import config
from threading import Lock from threading import Lock
...@@ -714,11 +715,10 @@ class Input(Win): ...@@ -714,11 +715,10 @@ class Input(Win):
""" """
if not len(self.text) or self.pos == 0: if not len(self.text) or self.pos == 0:
return return
previous_space = self.text[:self.pos+self.line_pos].rfind(' ') separators = string.punctuation+' '
if previous_space == -1: while self.pos > 0 and self.text[self.pos+self.line_pos-1] in separators:
previous_space = 0 self.key_left()
diff = self.pos+self.line_pos-previous_space while self.pos > 0 and self.text[self.pos+self.line_pos-1] not in separators:
for i in range(diff):
self.key_left() self.key_left()
return True return True
...@@ -728,11 +728,10 @@ class Input(Win): ...@@ -728,11 +728,10 @@ class Input(Win):
""" """
if len(self.text) == self.pos+self.line_pos or not len(self.text): if len(self.text) == self.pos+self.line_pos or not len(self.text):
return return
next_space = self.text.find(' ', self.pos+self.line_pos+1) separators = string.punctuation+' '
if next_space == -1: while len(self.text) != self.pos+self.line_pos and self.text[self.pos+self.line_pos] in separators:
next_space = len(self.text) self.key_right()
diff = next_space - (self.pos+self.line_pos) while len(self.text) != self.pos+self.line_pos and self.text[self.pos+self.line_pos] not in separators:
for i in range(diff):
self.key_right() self.key_right()
return True return True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment