Re: [code] Improved File Browser

From: Mitchell <m.att.foicica.com>
Date: Fri, 12 Oct 2018 11:56:11 -0400 (EDT)

Hi Alexander,

On Fri, 12 Oct 2018, Alexander Misel wrote:

> As for file browser, I wang to do things like:
> events.connect(events.BUFFER_AFTER_SWITCH, function ()
> if (buffer._type or ''):match('^%[File Browser') then
> highlight_folder()
> elseif M.view and M.view == view then
> local new_buffer = buffer
> if _BUFFERS[view._prev_buffer] and buffer ~= view._prev_buffer then
> view:goto_buffer(view._prev_buffer)
> highlight_folder()
> end
> for i, other_view in ipairs(_VIEWS) do
> if M.view ~= other_view then ui.goto_view(other_view) break end
> end
> view:goto_buffer(new_buffer)
> end
> end)
> But the gtk doesn't really focus on the new_buffer as in textadept.c, function lview_goto_buffer
> // If the indexed view is not currently focused, temporarily focus it so
> // `_G.buffer` in handlers is accurate.
> if (view != focused_view) focus_view(view);
> if (!initing) lL_event(L, "buffer_before_switch", -1);
> lL_gotodoc(L, view, lua_tointeger(L, 2), relative);
> if (!initing) lL_event(L, "buffer_after_switch", -1);
> if (focused_view != prev_view) focus_view(prev_view);
> return 0;
> And I don't know if there's a way to focus a view in Lua.

I don't think I understand what you are trying to do, but `ui.goto_view()` in Lua and `goto_view` in textadept.c both shift focus to the given view.

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 Fri 12 Oct 2018 - 11:56:11 EDT

This archive was generated by hypermail 2.2.0 : Sat 13 Oct 2018 - 06:29:36 EDT