Skip to content

Commit

Permalink
fixes and refactoring in autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
cvfosammmm committed Mar 24, 2022
1 parent 4950626 commit 0c7b554
Show file tree
Hide file tree
Showing 8 changed files with 551 additions and 787 deletions.
4 changes: 2 additions & 2 deletions setzer/app/autocomplete_provider/autocomplete_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(self, resources_path, workspace, latex_parser_regex, bibtex_parser_
self.parse_included_files()
GObject.timeout_add(2000, self.parse_included_files)

def get_items_for_completion_window(self, current_word, last_tabbed_command):
def get_items_for_completion_window(self, current_word, last_tabbed_command=None):
items = list()

items_all = self.get_items(current_word)
Expand All @@ -98,7 +98,7 @@ def get_items_for_completion_window(self, current_word, last_tabbed_command):

return items

def get_begin_end_items(self, word, last_tabbed_command):
def get_begin_end_items(self, word, last_tabbed_command=None):
try: items_all = self.static_begin_end_proposals[word.lower()]
except KeyError: items = list()
else:
Expand Down
597 changes: 547 additions & 50 deletions setzer/document/autocomplete/autocomplete.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions setzer/document/autocomplete/autocomplete_viewgtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def do_get_request_mode(self):

def update_position(self):
start_iter = self.content.source_buffer.get_iter_at_mark(self.content.source_buffer.get_insert())
start_iter.backward_chars(self.model.mode.get_offset())
start_iter.backward_chars(self.model.get_current_word_len())
self.x_position, self.y_position = self.content.get_screen_offsets_by_iter(start_iter)

def update_margins(self):
Expand All @@ -170,7 +170,7 @@ def update_sizes(self):
self.scrolled_window.set_min_content_width(35 * self.char_width)

def update_visibility(self):
if self.model.mode.will_show and self.position_is_visible() and not self.focus_hide and len(self.model.items) > 0:
if self.model.is_visible():
self.show_all()
else:
self.hide()
Expand Down
Empty file.
254 changes: 0 additions & 254 deletions setzer/document/autocomplete/modes/mode_begin_end.py

This file was deleted.

Loading

0 comments on commit 0c7b554

Please sign in to comment.