From 26a3c0c8251fd060b515aafe588dea844a20096c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sun, 17 Oct 2021 11:58:06 +0200 Subject: [PATCH] sdgui: bind ^W as in Readline --- src/sdgui.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sdgui.c b/src/sdgui.c index 7c111df..b270044 100644 --- a/src/sdgui.c +++ b/src/sdgui.c @@ -250,6 +250,12 @@ main (int argc, char *argv[]) // All the named colours have been there since GNOME 3.4 // (see gnome-extra-themes git history, Adwaita used to live there). const char *style = "notebook header tab { padding: 2px 8px; margin: 0; }" + // `gsettings set org.gnome.desktop.interface gtk-key-theme "Emacs"` + // isn't quite what I want, and note that ^U works by default + "@binding-set Readline {" + "bind 'H' { 'delete-from-cursor' (chars, -1) };" + "bind 'W' { 'delete-from-cursor' (word-ends, -1) }; }" + "entry { -gtk-key-bindings: Readline }" "stardict-view { padding: 0 .25em; }" "stardict-view.odd {" "background: @theme_base_color; " @@ -299,9 +305,6 @@ main (int argc, char *argv[]) // FIXME: when the clear icon shows, the widget changes in height g.entry = gtk_search_entry_new (); - // TODO: attach to the "key-press-event" signal and implement ^W at least, - // though ^U is working already! Note that bindings can be done in CSS - // as well, if we have any extra specially for the editor g_signal_connect (g.entry, "changed", G_CALLBACK (on_changed), g.view); // TODO: make the entry have a background colour, rather than transparency gtk_entry_set_has_frame (GTK_ENTRY (g.entry), FALSE);