aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-02-07 15:21:37 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2020-02-07 15:21:37 -0500
commit2047b26ccd29fbda123b328f88aad15566a6a705 (patch)
tree646af36899e4c806caaa7638f6b6c47fb85c45c3
parentb2f7d9b036b54bff893d0dbe916c326d0be8246b (diff)
downloadtextadept-2047b26ccd29fbda123b328f88aad15566a6a705.tar.gz
textadept-2047b26ccd29fbda123b328f88aad15566a6a705.zip
Update the buffer z-order list when switching between views too.
This fixes the case where switching between views can prevent switching to the previous view's buffer, which may be desirable.
-rw-r--r--core/ui.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/ui.lua b/core/ui.lua
index 90dcaa7e..2462f98f 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -175,7 +175,7 @@ events.connect(events.BUFFER_NEW, function()
end)
-- Updates the z-order list.
-events.connect(events.BUFFER_AFTER_SWITCH, function()
+local function update_zorder()
local i = 1
while i <= #buffers_zorder do
if buffers_zorder[i] == buffer or not _BUFFERS[buffers_zorder[i]] then
@@ -185,7 +185,9 @@ events.connect(events.BUFFER_AFTER_SWITCH, function()
end
end
table.insert(buffers_zorder, 1, buffer)
-end)
+end
+events.connect(events.BUFFER_AFTER_SWITCH, update_zorder)
+events.connect(events.VIEW_AFTER_SWITCH, update_zorder)
-- Saves and restores buffer zorder data during a reset.
events.connect(events.RESET_BEFORE,