diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-09-27 15:22:33 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-09-27 15:22:33 (GMT) |
commit | 33df9f0ac5512107efb6e3c8aa1e9e6864bac400 (patch) | |
tree | ba5ae997afa867d180acfc5c3a96aee1442f97b1 /textadapter.py | |
parent | 502990fcb8c319deca057e545b8db50d45874d5b (diff) |
Fix search in txt files - part of SL #3924
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'textadapter.py')
-rw-r--r-- | textadapter.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/textadapter.py b/textadapter.py index 2ff02dc..068c201 100644 --- a/textadapter.py +++ b/textadapter.py @@ -17,7 +17,7 @@ PAGE_SIZE = 38 # remove hard line breaks, apply a simple logic to try identify # the unneeded def _clean_text(line): - if line != '\r\n': + if line != '\r\n' and len(line) > 2: if line[-3] not in ('.', ',', '-', ';') and len(line) > 60: line = line[:-2] return line @@ -606,7 +606,7 @@ class _SearchThread(threading.Thread): def find_next(self): self._current_found_item = self._current_found_item + 1 if self._current_found_item >= len(self._found_records): - self._current_found_item = len(self._found_records) - 1 + self._current_found_item = 0 self.current_found_tuple = \ self._found_records[self._current_found_item] self._page = self.current_found_tuple[0] @@ -615,7 +615,7 @@ class _SearchThread(threading.Thread): def find_previous(self): self._current_found_item = self._current_found_item - 1 if self._current_found_item <= 0: - self._current_found_item = 0 + self._current_found_item = len(self._found_records) - 1 self.current_found_tuple = \ self._found_records[self._current_found_item] self._page = self.current_found_tuple[0] |