aboutsummaryrefslogtreecommitdiff
path: root/core/ext/pm/buffer_browser.lua
diff options
context:
space:
mode:
Diffstat (limited to 'core/ext/pm/buffer_browser.lua')
-rw-r--r--core/ext/pm/buffer_browser.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/core/ext/pm/buffer_browser.lua b/core/ext/pm/buffer_browser.lua
index 61f8b26e..4f618368 100644
--- a/core/ext/pm/buffer_browser.lua
+++ b/core/ext/pm/buffer_browser.lua
@@ -49,6 +49,18 @@ function get_context_menu(selected_item)
}
end
+local function update_view()
+ if matches(textadept.pm.entry_text) then
+ textadept.pm.activate()
+ for idx, buf in ipairs(textadept.buffers) do
+ if buf == buffer then
+ textadept.pm.cursor = idx - 1
+ break
+ end
+ end
+ end
+end
+
function perform_menu_action(menu_id, selected_item)
if menu_id == ID.NEW then
textadept.new_buffer()
@@ -64,20 +76,9 @@ function perform_menu_action(menu_id, selected_item)
view:goto_buffer(tonumber(selected_item[2]))
buffer:close()
end
- textadept.pm.activate()
+ update_view()
end
-local function update_view()
- if matches(textadept.pm.entry_text) then
- textadept.pm.activate()
- for idx, buf in ipairs(textadept.buffers) do
- if buf == buffer then
- textadept.pm.cursor = idx - 1
- break
- end
- end
- end
-end
textadept.events.add_handler('file_opened', update_view)
textadept.events.add_handler('buffer_new', update_view)
textadept.events.add_handler('buffer_deleted', update_view)
@@ -85,4 +86,3 @@ textadept.events.add_handler('save_point_reached', update_view)
textadept.events.add_handler('save_point_left', update_view)
textadept.events.add_handler('buffer_switch', update_view)
textadept.events.add_handler('view_switch', update_view)
-