Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support reconvert based on surrounding text.

  • Loading branch information...
commit 8ce6480291374b1071b44da229510398f0ee39f7 1 parent fcb4b23
@ueno authored
Showing with 16 additions and 1 deletion.
  1. +15 −0 src/engine.vala
  2. +1 −1  src/ibus-1.0.vapi
View
15 src/engine.vala
@@ -143,6 +143,16 @@ class SkkEngine : IBus.Engine {
});
update_candidates ();
update_input_mode ();
+ context.retrieve_surrounding_text.connect (retrieve_surrounding_text);
+ }
+
+ bool retrieve_surrounding_text (out string text, out uint cursor_pos) {
+ weak IBus.Text _text;
+ uint _cursor_pos, anchor_pos;
+ get_surrounding_text (out _text, out _cursor_pos, out anchor_pos);
+ text = _text.text.dup ();
+ cursor_pos = _cursor_pos;
+ return true;
}
void populate_lookup_table () {
@@ -421,6 +431,11 @@ class SkkEngine : IBus.Engine {
public override void enable () {
context.reset ();
+
+ // request to use surrounding text feature
+ weak IBus.Text text;
+ uint cursor_pos, anchor_pos;
+ get_surrounding_text (null, null, null);
}
public override void disable () {
View
2  src/ibus-1.0.vapi
@@ -169,7 +169,7 @@ namespace IBus {
public void delete_surrounding_text (int offset, uint nchars);
public void forward_key_event (uint keyval, uint keycode, uint state);
public unowned string get_name ();
- public void get_surrounding_text (out unowned IBus.Text text, uint cursor_pos, uint anchor_pos);
+ public void get_surrounding_text (out unowned IBus.Text text, out uint cursor_pos, out uint anchor_pos);
public void hide_auxiliary_text ();
public void hide_lookup_table ();
public void hide_preedit_text ();

0 comments on commit 8ce6480

Please sign in to comment.
Something went wrong with that request. Please try again.