[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] modal system, and reworking 'resize'

From: Aaron Griffin
Subject: [RP] modal system, and reworking 'resize'
Date: Mon, 7 May 2007 11:06:03 -0500

Hey all,
I wanted to throw this out there to see if there is any interest.

I recently changed the way ratpoison's resize command works in a local
version.  The idea is as follows:
The resize command is a bit at odds with the rest of the commands, as
the interactive resizing becomes more akin to a vim-style "mode" than
screen-style commands.
Using 'set topkmap' to swap, I created an internal keymap called
(surprise) "resize".  Instead of the resize command starting an
interactive "resize mode", I replaced the top keymap with "resize",
letting resize 'abort' and 'end' restore the original top keymap.

I find it much cleaner now, though I did define vshrink/vgrow and
hshrink/hgrow where I could simply issue "resize 0 1" or something
similar.  Just to show the mapping, it boils down to this:

definekey resize Up vgrow
definekey resize Down vshrink
definekey resize Right hgrow
definekey resize Left hshrink
.... all other keys previously defined...

definekey resize Esc resize_abort (restore frameset, set topkmap 'top')
definekey resize Return resize_end (delete frameset, set topkmap 'top')
bind r resize_begin (save frameset; show mode indicator; set topkmap resize)

Now, on to what is lost and what would make this better.  First off,
without defining "resize_begin", "resize_end", and "resize_abort"
there is no way to handle the resize undo the way it is handled now.
Instead, it would be feasible to push each (v|h)(grow|shrink) change
to the undo stack.  This doesn't bother me that much, but it might
bother others.
In addition, the "resize frame" indicator would be lost as well.
Refining the process to include a more modal system which would
indicate the current mode may fix this, however.

I'm writing this mainly to see if:
a) anyone is interested in a set of modal utilities like this (it is
already possible with 'set topkmap', but helpers would make it nicer).
b) to get opinions, and feedback.

My "patch" right now could use some work before I send it to the list,
so I wanted to see if it was worth it.

Aaron Griffin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]