Re: [code] [textadept] View splitting

From: Mitchell <m.att.foicica.com>
Date: Tue, 7 Oct 2014 09:18:39 -0400 (Eastern Daylight Time)

Hi,

On Fri, 3 Oct 2014, Mitchell wrote:

> Hi Chris,
>
> On Wed, 1 Oct 2014, Chris Emerson wrote:
>
>> Hi,
>>
>> I've mentioned this before a few months ago, but now I have more
>> experience.
>>
>> In textadept-vi, I use a normal (textredux) buffer for the command
>> entry,
>> which lets me do any fancy colouring, history, etc. I like.
>>
>> The problem is that I currently need to unsplit all the views, split
>> to make
>> the command entry buffer at the bottom, and then restore the split
>> view
>> configuration in the top view. When exiting the command entry, I have
>> to do
>> the whole thing in reverse.
>>
>> [snip]

The latest nightly uses a buffer as the command entry, so this should no
longer be necessary for you.

By default (since it is a Lua command entry) it has Lua syntax
highlighting. It also makes use of Scintilla's autocompletion facilities
for providing Lua completions.

For programmers: since this buffer is somewhat separate from Textadept's
normal buffers, it will never be `_G.buffer` -- even when the command
entry is active. Therefore, if you want to add key bindings to the entry,
you'll have to pass `ui.command_entry` as the buffer argument to any
buffer functions. (See `modules/textadept/command_entry.lua` for
examples.) If you want to make use of existing Textadept functions that
utilize `_G.buffer`, you'll have to temporarily set `_G.buffer`. For
example:

     -- Assign Ctrl+T to transpose characters.
     keys.lua_command.ct = function()
       local current_buffer = _G.buffer
       _G.buffer = ui.command_entry
       textadept.editing.transpose_chars()
       _G.buffer = current_buffer
     end

`ui.command_entry` also has a "height" property that gets or sets the
height of the entry in pixels. To make it 2 lines tall:

     ui.command_entry.height = 2 * ui.command_entry:text_height(1)

After that, you would be able to enter multiple lines by pressing
"Shift+Enter".

Let me know if there are questions or issues. This is a work-in-progress.

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 Tue 07 Oct 2014 - 09:18:39 EDT

This archive was generated by hypermail 2.2.0 : Wed 08 Oct 2014 - 06:32:36 EDT