Re: [code] [textadept] Programmatically moving splits

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Tue, 18 Aug 2015 10:10:30 +0100

Hi Mitchell,

On Sat, Aug 15, 2015 at 01:07:50PM -0400, Mitchell wrote:
[Resizing non-leaf splits]
> You are correct that there is no way to do this currently. The only
> (ugly) way I can think is to save the current view's size, unsplit
> it, resizing the now unsplit view (which would move the horizontal
> split), re-splitting the view, and restoring the saved size.

I'm not very keen on doing that - my Textadept enjoyment increased
dramatically when the command entry became a buffer and I didn't have to do
that anymore. :-) (Though entering commands is much more common than
adjusting split sizes, especially non-leaf splits)

One thing I've thought of is that the session load/save functions do most of
the hard work of doing that kind of thing. If they used an intermediate Lua-
friendly format, then one could tweak that to get this kind of change done
easily (though possibly with flickering - a potential future optimisation).

ie if it became:

function M.save(filename)
    local state = M.get_session_state()
    M.state_to_file(filename, state)
end

function M.load(filename)
    local state = M.file_to_state(filename)
    M.apply_session_state(state)
end

then I could do apply_session_state(my_adjust_sizes(get_session_state())).

> >My best idea (I haven't thought very hard) is stuffing some kind of ID
> >into the result of ui.get_split_table(), and passing that to another
> >function in ui (ui.move_split(id, value) or something).
>
> When I developed Textadept's split views, I never imagined it
> functioning as a sort of window manager, so I'd never thought of
> these kinds of situations. If this kind of thing was to be
> supported, I think refactoring Textadept's handling of split views
> is necessary.

Fair enough! I don't need this enough to get around to doing it myself,
but I'd make use of it if it happened. :-)

Thanks,

Chris

-- 
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 Tue 18 Aug 2015 - 05:10:30 EDT

This archive was generated by hypermail 2.2.0 : Tue 18 Aug 2015 - 06:27:19 EDT