Fix redo, reload commands.
Fix focusing editor on notebook tab click. Minor formatting and use NZV, DOC_FILENAME macros. Make doc_at() debug function check idx is within range. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/document-pointer@2702 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
57b3fb52b0
commit
4b1e4056b8
@ -292,7 +292,7 @@ on_redo1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
GeanyDocument *doc = document_get_current();
|
||||
if (doc == NULL && (document_can_redo(doc)))
|
||||
if (doc != NULL && document_can_redo(doc))
|
||||
document_redo(doc);
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ on_copy1_activate (GtkMenuItem *menuitem,
|
||||
if (GTK_IS_EDITABLE(focusw))
|
||||
gtk_editable_copy_clipboard(GTK_EDITABLE(focusw));
|
||||
else
|
||||
if (IS_SCINTILLA(focusw) && doc!= NULL)
|
||||
if (IS_SCINTILLA(focusw) && doc != NULL)
|
||||
sci_copy(doc->sci);
|
||||
else
|
||||
if (GTK_IS_TEXT_VIEW(focusw))
|
||||
@ -1952,8 +1952,7 @@ on_context_action1_activate (GtkMenuItem *menuitem,
|
||||
|
||||
/* use the filetype specific command if available, fallback to global command otherwise */
|
||||
if (doc->file_type != NULL &&
|
||||
doc->file_type->context_action_cmd != NULL &&
|
||||
*doc->file_type->context_action_cmd != '\0')
|
||||
NZV(doc->file_type->context_action_cmd))
|
||||
{
|
||||
command = g_strdup(doc->file_type->context_action_cmd);
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ GeanyDocument *document_new_file(const gchar *filename, GeanyFiletype *ft, const
|
||||
}
|
||||
|
||||
msgwin_status_add(_("New file \"%s\" opened."),
|
||||
(doc->file_name != NULL) ? doc->file_name : GEANY_STRING_UNTITLED);
|
||||
DOC_FILENAME(doc));
|
||||
|
||||
return doc;
|
||||
}
|
||||
@ -1234,7 +1234,7 @@ gboolean document_reload_file(GeanyDocument *doc, const gchar *forced_enc)
|
||||
gint pos = 0;
|
||||
GeanyDocument *new_doc;
|
||||
|
||||
if (doc != NULL)
|
||||
if (doc == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* try to set the cursor to the position before reloading */
|
||||
@ -2467,7 +2467,7 @@ GdkColor *document_get_status_color(GeanyDocument *doc)
|
||||
#ifdef GEANY_DEBUG
|
||||
GeanyDocument *doc_at(gint idx)
|
||||
{
|
||||
return (idx >= 0) ? documents[idx] : NULL;
|
||||
return (idx >= 0 && idx < (gint) documents_array->len) ? documents[idx] : NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -81,7 +81,7 @@ static void focus_sci(GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
GeanyDocument *doc = document_get_current();
|
||||
|
||||
if (doc != NULL)
|
||||
if (doc == NULL)
|
||||
return;
|
||||
|
||||
gtk_widget_grab_focus(GTK_WIDGET(doc->sci));
|
||||
|
Loading…
x
Reference in New Issue
Block a user