Thanks for all Alex, i'll check it this weekend :) Roberto
2015-02-18 9:23 GMT+01:00 Alexander Larsson <[email protected]>: > I just tested the emacs mode, and it has some issues. > Some commands worked for me, but then it suddently didn't work at all > anymore. I put a printf of priv->cmd into > gb_source_emacs_key_press_event_cb, and the cause was obvious. > To do key binding matches it creates a string of each key pressed with a > modifier in order, then matches these against a set of regexps. > So, if i type ctrl+x and ctrl+c then it becomes "C-x C-c", which matches > the "^C-x C-c$" exit-the-app regexp. > > There are several issues with this: > > If I enter any non-matching command, say "C-c C-c" it never detects that > there is no such command, so it never resets. I get this: > priv->cmd: C-c C-c C-x C-c C-c C-c C-c C-c C-c C-x C-c C-x C-c C-x C-c > Which will never match anything, and i suddenly can't use any emacs > commands anymore. > > Secondly this is not how emacs works. Emacs has one global keymap which > is the "normal" commands like entering text or pasting with ctrl-y. But > it also has commands like Ctrl-X which *completely* swap the current > keymap, disabling all global keymaps operations. This is how Ctrl-x > Ctrl-C works, Ctrl-x swaps the keymaps and Ctrl-C is a keybinding in the > new keymap. At any point in a non-global keymap, if you type something > that is not bound you get a beep and "XXX is undefined" warning and get > back to the global keymap. This is different from the above because if > you press ctrl-x first, you can then use the regular key bindings. > For instance you can press ctrl-x, then left arrow (moving the cursor) > and *then* ctrl-c, exiting the app. > > Third, this is not how Gtk+ keybindings work. In fact, gtk+ already has > some level of emacs keybindings: > https://git.gnome.org/browse/gtk+/tree/gtk/gtk-keys.css.emacs > If you set the key theme to Emacs you get these everywhere. > I think we should use the same method (CSS + GtkBindingSet) to define > keyboard bindings for gnome-builder. All we need is a way to temporarily > disable the global key bindings and apply a new binding set while we're > in e.g. the Ctrl-x "mode". In fact, it seems to me like this could be > used to implement Vi mode too. > > I'll have a quick look at this today, but unfortunately I don't have a > lot of time to work on this atm... > > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Alexander Larsson Red Hat, Inc > [email protected] [email protected] > He's an oversexed coffee-fuelled paramedic on the hunt for the last > specimen of a great and near-mythical creature. She's a mentally unstable > psychic research scientist trying to make a difference in a man's world. > They fight crime! > > _______________________________________________ > Builder-list mailing list > [email protected] > https://mail.gnome.org/mailman/listinfo/builder-list > -- Roberto Majadas OpenShine S.L email : [email protected] tlf : +34 663 273 501 www.openshine.com
_______________________________________________ Builder-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/builder-list
