Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

851 fix word completion logic #1487

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Bring back handling of words from text inserted that isn't at a word …
…boundaryto the Word Completion plugin
  • Loading branch information
colinkiama committed Nov 2, 2024
commit 79e0429a9459f6003c390344beef7191d70b17b3
6 changes: 6 additions & 0 deletions plugins/word-completion/plugin.vala
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ public class Scratch.Plugins.Completion : Peas.ExtensionBase, Peas.Activatable {

if (pos.ends_word ()) {
this.handle_insert_at_phrase_end (pos, new_text, new_text_length);
} else {
this.handle_insert_not_at_word_boundary (pos, new_text, new_text_length);
}
}

Expand All @@ -148,6 +150,10 @@ public class Scratch.Plugins.Completion : Peas.ExtensionBase, Peas.Activatable {
parser.parse_string (full_phrases);
}

private void handle_insert_not_at_word_boundary (Gtk.TextIter pos, string new_text, int new_text_length) {
parser.parse_string (new_text);
}

private string provider_name_from_document (Scratch.Services.Document doc) {
return _("%s - Word Completion").printf (doc.get_basename ());
}
Expand Down