aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2019-10-06 10:04:44 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2019-10-06 10:04:44 -0400
commit8f6e84773c73940934f87063c4fda48360ffa3b8 (patch)
tree551f4c458495ae722b46b148d388374f346f6928 /src
parent0e98bdbec356119b10b02e8d0930f35ff7fd7ae3 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/textadept.c2
1 files changed, 1 insertions, 1 deletions
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);