| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bb81a75 commit 861a883
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -532,24 +532,19 @@ def process_key_event(self, e): | |||
| 532 | 532 | self.add_normal_character(e) | |
| 533 | 533 | ||
| 534 | 534 | def get_last_word(self): | |
| 535 | - entry = self.rl_history.entry | ||
| 536 | 535 | ||
| 537 | - self.current_line=self.current_line[:-len(entry)] | ||
| 538 | - | ||
| 539 | - self._set_cursor_offset(self.cursor_offset-len(entry)) | ||
| 540 | - | ||
| 541 | - last_history_entry = self.rl_history.back() | ||
| 542 | - | ||
| 543 | - last_word = last_history_entry.split().pop() | ||
| 544 | - | ||
| 545 | - # print 'first', self.cursor_offset | ||
| 546 | - self.current_line=self.current_line+last_word | ||
| 536 | + def last_word(line): | ||
| 537 | + if not line: | ||
| 538 | + return '' | ||
| 539 | + return line.split().pop() | ||
| 547 | 540 | ||
| 548 | - self._set_cursor_offset(self.cursor_offset+len(last_word)) | ||
| 549 | - #print len(self.rl_history.entry) | ||
| 541 | + previous_word = last_word(self.rl_history.entry) | ||
| 542 | + word = last_word(self.rl_history.back()) | ||
| 543 | + line=self.current_line | ||
| 544 | + self._set_current_line(line[:len(line)-len(previous_word)]+word, reset_rl_history=False) | ||
| 550 | 545 | ||
| 551 | - # self._set_cursor_offset(remember_cursor_offset) | ||
| 552 | - # print 'second', self.cursor_offset | ||
| 546 | + self._set_cursor_offset(self.cursor_offset-len(previous_word)+len(word), reset_rl_history=False) | ||
| 547 | + | ||
| 553 | 548 | ||
| 554 | 549 | def incremental_search(self, reverse=False, include_current=False): | |
| 555 | 550 | if self.special_mode == None: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments