aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-02-26 19:54:17 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2009-02-26 19:54:17 -0500
commit2247caa255f3a9cdf3413e5396d814fe4a092506 (patch)
treeafe40c5eaa163cca3377ca72ee0e3dbc228263a3
parente835d0704af36e5e9ac50f413157a60e58eb9e6c (diff)
downloadtextadept-2247caa255f3a9cdf3413e5396d814fe4a092506.tar.gz
textadept-2247caa255f3a9cdf3413e5396d814fe4a092506.zip
Update the PM cursor on menu action; 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)
-