Re: [code] [textadept] Using normal buffer as command entry

From: Mitchell <m.att.foicica.com>
Date: Wed, 12 Feb 2014 13:53:32 -0500 (Eastern Standard Time)

Hi Chris,

On Tue, 11 Feb 2014, Chris Emerson wrote:

> Hi,
>
> I've been experimenting with using a normal TA buffer in a small split view
> as a more flexible replacement for the command entry (actually with
> Textredux). I quite like it - I can colour it at will, play with the cursor
> position, history, etc., enlarge it to show completions, etc.
>
> There are two annoyances it'd be nice to solve, though:
> * I currently save the window configuration, unsplit everything, split to
> make the 1-line entry, and recreate the original splits, and then do it all
> again when exiting the entry again. This is flickery, especially with a few
> splits.
>
> The simplest "fix" I can think of would be to allow view.size=(full size
> of parent) and define it to hide the second view and the divider, so
> that instead of rebuilding everything it's just a case of adjusting
> view.size.

I wouldn't want to hide the split because that's hiding information. While
adding a `view:maximize()`-style may be helpful in certain situations, it
breaks down with an arrangement like:

   +--+--+
   |v1|v2|
   +--+--+
   |v3|v4|
   +--+--+

How would `v3:maximize()` behave?

> The least simple would be to replace the GTK entry/CDKEntry with a
> dedicated buffer and some more Lua code...

Right, this is not desirable.

> * In the GTK version, I haven't worked out how to make the split the right
> height for exactly one line of text.

I don't think there is an elegant way to determine the view dimensions,
but I happened upon something curious:

   * Split horizontally.
   * Set `view.size = 1000` (or something large enough to hide the other
     view.
   * Open the command entry and close it again.
   * About a line of the other view is now visible.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 12 Feb 2014 - 13:53:32 EST

This archive was generated by hypermail 2.2.0 : Thu 13 Feb 2014 - 06:49:23 EST