aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);