commit 45604d64dfd6d28c9ca279f194836e556ff28995
parent 7d64b33bfe7f2e7c3aaecbea93677c97d482e30f
Author: lumidify <nobody@lumidify.org>
Date: Wed, 10 Mar 2021 08:38:03 +0100
Set cursor to replaced word in context text boxes
Diffstat:
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/transliterate.pl b/transliterate.pl
@@ -132,6 +132,9 @@ sub prompt_unknown_word {
$buffer->insert_with_tags($start_iter, $wrd, $highlight);
$start_iter = $buffer->get_start_iter();
$buffer->insert($start_iter, $ctxtl);
+ # set cursor position to beginning of word
+ my $cur_iter = $buffer->get_iter_at_offset(length($ctxtl));
+ $buffer->place_cursor($cur_iter);
my $button = Gtk3::Button->new($btn_lbl);
$button->signal_connect(
clicked => sub {
@@ -154,8 +157,16 @@ sub prompt_unknown_word {
$hbox->pack_start($button, FALSE, FALSE, 0);
$vbox->pack_start($hbox, FALSE, FALSE, 0);
};
- $make_context_box->($contextl, $word_repl, $contextr, "Transliterated _context: ", "Use _transliterated selection as word");
- $make_context_box->($contextl_orig, $word, $contextr_orig, "Ori_ginal context: ", "Use _original selection as word");
+ $make_context_box->(
+ $contextl_orig, $word, $contextr_orig,
+ "Ori_ginal context: ",
+ "Use _original selection as word"
+ );
+ $make_context_box->(
+ $contextl, $word_repl, $contextr,
+ "Transliterated _context: ",
+ "Use _transliterated selection as word"
+ );
my $hbox = Gtk3::HBox->new(FALSE, 5);
my $label = Gtk3::Label->new("Ignore: ");