| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c9c0cbf commit acde8ab
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -465,21 +465,20 @@ def complete(self, tab=False): | |||
| 465 | 465 | self.scr.touchwin() #TODO necessary? | |
| 466 | 466 | return | |
| 467 | 467 | ||
| 468 | - if self.config.auto_display_list or tab: | ||
| 469 | - list_win_visible = repl.Repl.complete(self, tab) | ||
| 470 | - if list_win_visible: | ||
| 471 | - try: | ||
| 472 | - self.show_list(self.matches_iter.matches, topline=self.argspec, formatter=self.matches_iter.completer.format) | ||
| 473 | - except curses.error: | ||
| 474 | - # XXX: This is a massive hack, it will go away when I get | ||
| 475 | - # cusswords into a good enough state that we can start | ||
| 476 | - # using it. | ||
| 477 | - self.list_win.border() | ||
| 478 | - self.list_win.refresh() | ||
| 479 | - list_win_visible = False | ||
| 480 | - if not list_win_visible: | ||
| 481 | - self.scr.redrawwin() | ||
| 482 | - self.scr.refresh() | ||
| 468 | + list_win_visible = repl.Repl.complete(self, tab) | ||
| 469 | + if list_win_visible: | ||
| 470 | + try: | ||
| 471 | + self.show_list(self.matches_iter.matches, topline=self.argspec, formatter=self.matches_iter.completer.format) | ||
| 472 | + except curses.error: | ||
| 473 | + # XXX: This is a massive hack, it will go away when I get | ||
| 474 | + # cusswords into a good enough state that we can start | ||
| 475 | + # using it. | ||
| 476 | + self.list_win.border() | ||
| 477 | + self.list_win.refresh() | ||
| 478 | + list_win_visible = False | ||
| 479 | + if not list_win_visible: | ||
| 480 | + self.scr.redrawwin() | ||
| 481 | + self.scr.refresh() | ||
| 483 | 482 | ||
| 484 | 483 | def clrtobol(self): | |
| 485 | 484 | """Clear from cursor to beginning of line; usual C-u behaviour""" | |
@@ -510,31 +509,6 @@ def cut_to_buffer(self): | |||
| 510 | 509 | self.scr.redrawwin() | |
| 511 | 510 | self.scr.refresh() | |
| 512 | 511 | ||
| 513 | - def cw(self): | ||
| 514 | - """Return the current word, i.e. the (incomplete) word directly to the | ||
| 515 | - left of the cursor""" | ||
| 516 | - | ||
| 517 | - # I don't know if autocomplete should be disabled if the cursor | ||
| 518 | - # isn't at the end of the line, but that's what this does for now. | ||
| 519 | - if self.cpos: return | ||
| 520 | - | ||
| 521 | - # look from right to left for a bad method or dictionary character | ||
| 522 | - l = len(self.s) | ||
| 523 | - is_method_char = lambda c: c.isalnum() or c in ('.', '_') | ||
| 524 | - dict_chars = ['['] | ||
| 525 | - | ||
| 526 | - if not self.s or not (is_method_char(self.s[-1]) | ||
| 527 | - or self.s[-1] in dict_chars): | ||
| 528 | - return | ||
| 529 | - | ||
| 530 | - for i in range(1, l+1): | ||
| 531 | - c = self.s[-i] | ||
| 532 | - if not (is_method_char(c) or c in dict_chars): | ||
| 533 | - i -= 1 | ||
| 534 | - break | ||
| 535 | - | ||
| 536 | - return self.s[-i:] | ||
| 537 | - | ||
| 538 | 512 | def delete(self): | |
| 539 | 513 | """Process a del""" | |
| 540 | 514 | if not self.s: | |
@@ -1458,12 +1432,13 @@ def tab(self, back=False): | |||
| 1458 | 1432 | # 2. run complete() if we aren't already iterating through matches | |
| 1459 | 1433 | if not self.matches_iter: | |
| 1460 | 1434 | self.complete(tab=True) | |
| 1435 | + self.print_line(self.s) | ||
| 1461 | 1436 | ||
| 1462 | 1437 | # 3. check to see if we can expand the current word | |
| 1463 | 1438 | if self.matches_iter.is_cseq(): | |
| 1464 | - _, self.s = self.matches_iter.substitute_cseq() | ||
| 1439 | + self.cursor_offset, self.s = self.matches_iter.substitute_cseq() | ||
| 1465 | 1440 | self.print_line(self.s) | |
| 1466 | - if not self.matches_iter and self.config.auto_display_list: | ||
| 1441 | + if not self.matches_iter: | ||
| 1467 | 1442 | self.complete() | |
| 1468 | 1443 | ||
| 1469 | 1444 | # 4. swap current word for a match list item | |
| Back | FazBrowse Home | New Git URL |
0 commit comments