aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-03-08 16:29:43 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2009-03-08 16:29:43 -0400
commit98d193eaad207c87416f364592693872c98ddc78 (patch)
treeb268baaf3074633963aa8380442137b8a5dc88d6 /core
parent1eb3758185ca35686179b11da6a0c821c82b3e0e (diff)
downloadtextadept-98d193eaad207c87416f364592693872c98ddc78.tar.gz
textadept-98d193eaad207c87416f364592693872c98ddc78.zip
Fixed issue with buffer browser cursor saving; core/ext/pm/buffer_browser.lua
Diffstat (limited to 'core')
-rw-r--r--core/ext/pm/buffer_browser.lua29
1 files changed, 16 insertions, 13 deletions
diff --git a/core/ext/pm/buffer_browser.lua b/core/ext/pm/buffer_browser.lua
index 4f618368..d1fa4295 100644
--- a/core/ext/pm/buffer_browser.lua
+++ b/core/ext/pm/buffer_browser.lua
@@ -49,18 +49,6 @@ 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()
@@ -76,9 +64,12 @@ function perform_menu_action(menu_id, selected_item)
view:goto_buffer(tonumber(selected_item[2]))
buffer:close()
end
- update_view()
+ textadept.pm.activate()
end
+local function update_view()
+ if matches(textadept.pm.entry_text) then textadept.pm.activate() 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)
@@ -86,3 +77,15 @@ 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)
+
+local function set_cursor()
+ if matches(textadept.pm.entry_text) then
+ 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('pm_view_filled', set_cursor)