diff options
author | 2009-02-08 13:34:59 -0500 | |
---|---|---|
committer | 2009-02-08 13:34:59 -0500 | |
commit | 33e9c58f408be3c42144b28464a029902580031d (patch) | |
tree | 6fe946e6931fd2454545dfd34ba84801b207ec33 /src/textadept.c | |
parent | 25b785dfc7f125b66a6ed1fc7b661a2435dc7bf0 (diff) | |
download | textadept-33e9c58f408be3c42144b28464a029902580031d.tar.gz textadept-33e9c58f408be3c42144b28464a029902580031d.zip |
Cleaned up code, used argchecks instead of Lua errors, and enhanced stability.
Instead of throwing luaL_error() for bad arguments, use luaL_argcheck() and
luaL_argerror() for more descriptive messages.
Store the 'textadept' table's 'buffers', 'views', 'constants',
'buffer_functions', and 'buffer_properties' tables in the Lua registry and refer
to them via metatables so that overwrites are not possible; removed 'rawset'
for Lua scripts.
Diffstat (limited to 'src/textadept.c')
-rw-r--r-- | src/textadept.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/textadept.c b/src/textadept.c index 62053c11..80fe526b 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -379,13 +379,12 @@ bool unsplit_window(GtkWidget *editor) { : remove_scintilla_window(other); GtkWidget *parent = gtk_widget_get_parent(pane); gtk_container_remove(GTK_CONTAINER(parent), pane); - if (GTK_IS_PANED(parent)) + if (GTK_IS_PANED(parent)) { if (!gtk_paned_get_child1(GTK_PANED(parent))) gtk_paned_add1(GTK_PANED(parent), editor); else gtk_paned_add2(GTK_PANED(parent), editor); - else - gtk_container_add(GTK_CONTAINER(parent), editor); + } else gtk_container_add(GTK_CONTAINER(parent), editor); gtk_widget_show_all(parent); gtk_widget_grab_focus(GTK_WIDGET(editor)); g_object_unref(editor); @@ -450,7 +449,7 @@ void ce_toggle_focus() { * @see t_notification * @see t_command */ -static void switch_view(GtkWidget *editor) { +static void switch_to_view(GtkWidget *editor) { focused_editor = editor; l_set_view_global(editor); l_set_buffer_global(SCINTILLA(editor)); @@ -463,7 +462,7 @@ static void switch_view(GtkWidget *editor) { static void t_notification(GtkWidget *editor, gint, gpointer lParam, gpointer) { SCNotification *n = reinterpret_cast<SCNotification*>(lParam); if (focused_editor != editor && n->nmhdr.code == SCN_URIDROPPED) - switch_view(editor); + switch_to_view(editor); l_handle_scnnotification(n); } @@ -472,7 +471,7 @@ static void t_notification(GtkWidget *editor, gint, gpointer lParam, gpointer) { * Currently handles SCEN_SETFOCUS. */ static void t_command(GtkWidget *editor, gint wParam, gpointer, gpointer) { - if (wParam >> 16 == SCEN_SETFOCUS) switch_view(editor); + if (wParam >> 16 == SCEN_SETFOCUS) switch_to_view(editor); } /** @@ -563,8 +562,7 @@ static OSErr w_ae_open(const AppleEvent *event, AppleEvent*, long) { * @see w_exit */ static OSErr w_ae_quit(const AppleEvent *event, AppleEvent*, long) { - if (w_exit(NULL, NULL, NULL)) return noErr; - return errAEEventNotHandled; + return w_exit(NULL, NULL, NULL) ? noErr : errAEEventNotHandled; } /** |