From 8f6e84773c73940934f87063c4fda48360ffa3b8 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 6 Oct 2019 10:04:44 -0400 Subject: Ensure `events.BUFFER_BEFORE_SWITCH` is emitted properly during `buffer.new()`. It appears that calling SCI_CREATEDOCUMENT alters view state immediately such that at least fold state is no longer available to store. --- src/textadept.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/textadept.c b/src/textadept.c index a8a29c7c..c7a0c1ee 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1332,8 +1332,8 @@ static void lL_adddoc(lua_State *L, sptr_t doc) { */ static void new_buffer(sptr_t doc) { if (!doc) { - doc = SS(focused_view, SCI_CREATEDOCUMENT, 0, 0); // create the new document lL_event(lua, "buffer_before_switch", -1); + doc = SS(focused_view, SCI_CREATEDOCUMENT, 0, 0); // create the new document lL_adddoc(lua, doc); lL_gotodoc(lua, focused_view, -1, FALSE); } else lL_adddoc(lua, doc), SS(focused_view, SCI_ADDREFDOCUMENT, 0, doc); -- cgit v1.2.3