Re: [textadept] Get the "Switch Buffer" and the "Snapopen" dialog to remember there last size

From: Robert <>
Date: Wed, 27 Jul 2011 13:55:59 +0200


On Tue, Jul 26, 2011 at 10:18 PM, Ryan Pusztai <> wrote:
> Hi Mitchell,
> Thanks for the quick reply.
> On Tue, Jul 26, 2011 at 2:32 PM, mitchell <> wrote:
>> Hi Ryan,
>> Dialog size unfortunately cannot be saved since they are provided by
>> gcocoadialog, however there are a couple ways of going about this:
>> 1.
>> * Define your own switchbuffer based on gui.switchbuffer code and add
>>  '--width', 'ddd', '--height', 'ddd' arguments to the gui.filteredlist()
>>  call where 'ddd' are your desired dimensions. Then you can assign a key
>>  command to your function (e.g. keys.cb = my_switchbuffer). This can all
>>  be done in your ~/.textadept/init.lua.
>> * Copy the snapopen module to ~/.textadept/modules/textadept/ and modify
>>  the gui.filteredlist() call just like above, adding '--width', etc.
>>  arguments.
> OK that sounds reasonable. Do you think it would be reasonable to save the
> size to a file? Or is the issue that you can't get the size from the dialog
> after it is closed?

I think the only way would be to modify Gcocoadialog's C code to save
the current width to a file (which you could read from TA) or add this
to its output (potentially breaking other functions in TA). Setting
the width in TA is what I did in my Bibtex module:

how about having a global option to set the filteredList width?
You'd accept a patch?

>> 2.
>> Modify core/gui.lua and snapopen.lua directly as described above. (Not
>> recommended).
>> mitchell
> What about using the "Name" column, from the "Switch Buffer" dialog in the
> Snapopen dialog? That is mostly my issue. That would get me a long way.
> --
> Regards,
> Ryan

You could modify snapopen, from gui.lua you would need the line that
filters the filename out of the complete path:
items[#items + 1] = (buffer.dirty and '*' or '')..filename:match('[^/\\]+$')
items[#items + 1] = filename

and modify the snapopen function to use the second as an output column

Received on Wed 27 Jul 2011 - 07:55:59 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:14:45 EST