Re: Ctrl-Tab to go back to the most-recently-used buffer

From: mitchell <>
Date: Wed, 13 May 2009 21:16:48 -0700 (PDT)


> Problem is: _G.previous_buffer_idx always has the current buffer index, not
> the previous one's.

'buffer_switch' is activated after the switch occurs, so 'buffer'
always referrers to the current buffer naturally. One solution would
be to use an intermediate variable.'buffer_switch',
    for idx, buf in ipairs(textadept.buffers) do
      if buf == buffer then
        _G.previous_buffer_idx = _G.current_buffer_idx or idx
        _G.current_buffer_idx = idx

There may be more elegant solutions, but this is the midnight one ;)
Received on Thu 14 May 2009 - 00:16:48 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:37:53 EST