aboutsummaryrefslogtreecommitdiff
path: root/src/textadept.c
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-05-15 17:00:50 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-05-15 17:00:50 -0400
commitd042865f672d6708df80250c9c59172148a55f11 (patch)
treea9c38372853d202d843564ebff9c6eeee60b88fb /src/textadept.c
parente2767cd40f0994ea97cb91fb9e9ceef58b8f3342 (diff)
downloadtextadept-d042865f672d6708df80250c9c59172148a55f11.tar.gz
textadept-d042865f672d6708df80250c9c59172148a55f11.zip
Rewrote theme implementation.
Themes are now just single files that share Textadept's Lua state. Also added a new "settings.lua" that functions in place of buffer and view theme files. Requires latest Scintillua.
Diffstat (limited to 'src/textadept.c')
-rw-r--r--src/textadept.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/textadept.c b/src/textadept.c
index 9fe52c1d..8d8b1034 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -1877,9 +1877,10 @@ static void split_view(Scintilla *view, int vertical) {
gtk_widget_get_allocation(view, &allocation);
int middle = (vertical ? allocation.width : allocation.height) / 2;
- g_object_ref(view);
- GtkWidget *view2 = new_view(curdoc);
GtkWidget *parent = gtk_widget_get_parent(view);
+ if (!parent) return; // error on startup (e.g. loading theme or settings)
+ GtkWidget *view2 = new_view(curdoc);
+ g_object_ref(view);
gtk_container_remove(GTK_CONTAINER(parent), view);
GtkWidget *pane = vertical ? gtk_hpaned_new() : gtk_vpaned_new();
gtk_paned_add1(GTK_PANED(pane), view), gtk_paned_add2(GTK_PANED(pane), view2);
@@ -1988,12 +1989,12 @@ static Scintilla *new_view(sptr_t doc) {
#endif
SS(view, SCI_USEPOPUP, 0, 0);
lL_addview(lua, view);
+ l_setglobalview(lua, view);
focused_view = view, focus_view(view);
if (doc) {
SS(view, SCI_SETDOCPOINTER, 0, doc);
l_setglobaldoc(lua, doc);
} else new_buffer(SS(view, SCI_GETDOCPOINTER, 0, 0));
- l_setglobalview(lua, view);
lL_event(lua, "view_new", -1);
return view;
}