Re: [code] Removing the filename and path from the Textadept titlebar

From: Russell Dickenson <russelldickenson.att.gmail.com>
Date: Thu, 26 Nov 2015 14:01:45 +1000

Michal,

Thank you! That addition has worked perfectly.

On 25 November 2015 at 21:22, Michal Kottman <k0mpjut0r.att.gmail.com> wrote:
>
> On Nov 25, 2015 12:40 AM, "Russell Dickenson" <russelldickenson.att.gmail.com>
> wrote:
>
>> -- Sets the title of the Textadept window to the buffer's filename.
>> local function set_title()
>> local filename = buffer.filename or buffer._type or _L['Untitled']
>> filename = filename:iconv('UTF-8', _CHARSET)
>> local basename = buffer.filename and filename:match('[^/\\]+$') or
>> filename
>> local basepath = buffer.filename and filename:match('.+/') or filename
>> ui.title = string.format('%s %s Textadept (%s)', basename,
>> buffer.modify and '*' or '-', basepath)
>> buffer.tab_label = basename..(buffer.modify and '*' or '')
>> end
>>
>> I also need to note that if
>> Textadept is open with no files loaded, the titlebar then reads
>> "Untitled - Textadept - (Untitled)" which is not as pretty as I would
>> like. I'll continue tweaking this, most likely putting "Textadept" at
>> the end of the string. No offense intended, Mitchell. :D
>
> In the 'Untitled'/no file case, you can just use a different title, e.g.:
>
> -- Sets the title of the Textadept window to the buffer's filename.
> local function set_title()
> if not (buffer.filename or buffer.type) then
> ui.title = 'Untitled'
> buffer.tab_label = 'Untitled'
> return
> end
> local filename = buffer.filename or buffer._type
> ...

-- 
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 25 Nov 2015 - 23:01:45 EST

This archive was generated by hypermail 2.2.0 : Thu 26 Nov 2015 - 06:29:22 EST