Re: [Cgdb-users] key bindings
Brought to you by:
bobbybrasko,
crouchingturbo
From: Bob R. <bob...@co...> - 2007-08-07 14:06:15
|
On Tue, Aug 07, 2007 at 07:43:48AM -0400, Peter Kovacs wrote: > On Tue, Aug 07, 2007 at 05:32:46AM +0100, William Pursell wrote: > > > One solution, which wouldn't be super friendly, is to provide a way to > > > send esc to readline by having an escape key. For instance, if you type > > > '<esc><esc>', than that escape goes to gdb. These solutions tend to be > > > a pain on users I think though. > > Why not add a new key-code like <gdb-esc> which sends the <esc> directly > to gdb instead of cgdb? Its been a while since I looked at the code, > but maybe that's a little easier to do, and a little more > self-documenting. OK, here is the summary of our situation. This problem hits deep into the design of cgdb. Currently, libcex hasn't been written yet. libcex is inteded to be a library that allows CGDB to map any set of keys to any CGDB action. This library is still in the design phase, as it might stay for a long time without developer contribution. There are 2 possible designs for this library, one is what I call the 'vi style' design, which hardcodes keys to a particular action. You can't change what keys cause which actions. Thus the library wouldn't support having a vim and an emacs mode style interface. The advantage to this design is that because the keys are specific to a commamd, it's easy to have CGDB do command specific things while the user is actively typing the keys. Think of how vim allows you to type, 'd/foo<Enter>' After you type the /, in the middle of the delete command, it starts searching for foo. Now that's context! With this design, the library will simply be an abstraction of what keys do what action. The user can not modify this. The other design is what I call the 'mutt' design. They essentially allow you to map any set of keys to any command. So, each cgdb command will have a name, and potentially a set of parameters. This allows for the user to customize the front end with multiple feels (vi, emacs). The downside is you loose context during interactive typing, unless you create some sort of very complicated description of the command. Now, I mention all of this because what you are asking for would essentially require a higher level library to allow the user to tune CGDB to understand what command it should do based on what the user typed. With all of this in mind, since it will be a while before this particular feature is available cleanly, it was suggested by Peter, that we make a config option, 'set escape-key key' that will allow us to define what the escape key is. The default would be, 'set escape-key <Esc>'. You could change that to whatever you want. That would allow you to setup CGDB so that a different key would be responsible for you to get in and out of CGDB/GDB mode. Now, after that is implemented, it might just automatically work they way you want. Since, there would be no reason to eat the <Esc> key to go into insert mode, CGDB would just send it to GDB/readline. This is an initial idea, does anyone see any holes in it? Does anyone object? The main issue is that vim doesn't have a 'set escape-key' command. So, once we wrote libcex, we may have to end up dropping the command. Thanks, Bob Rossi |