The Accidental Rubyist

invalid byte sequence in UTF-8

Emacs fun in ruby ncurses library

leave a comment »

For all those situations where numeric arguments or numeric prefixes to methods cannot be specified by typing a number (typically editable components), we have 2 ways of specifying, copied shamefully from emacs.

1. C-u – each press of C-u multiplies a “multiplier” by 4. So you get 4 16 64.
To go execute C-n 16 times, one can do: C-u C-u C-n.

2. C-u 16 C-n
After C-u enter numbers, and end with key binding.
You can terminate a number with a second C-u as C-u 16 C-u 0. This is required if the command itself is numeric. Here 0 is a command.

3. Use the key M-1 through M-9to specify numeric argument. For larger numbers pressing M (alt) is not required. Example, M-1 6 M-n, executes M-n 16 times. Perhaps, emacs people use the C-u when the command is invokes by Control, and M-1 when invoked by Meta. I don’t know. I just know that we’ve got to make this ncurses widget library as powerful as possible. And key-bindings are an important way.
If my explanation did not make sense, you can read this page. Note, i’ve not implemented negative arguments (yet).

WARNING ! Since I am catching C-u globally, therefore C-u is no longer used as undo in Field and Textarea. I’ve used C-_ for undo.

Advertisements

Written by totalrecall

February 26, 2010 at 8:59 pm

Posted in rbcurse

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: