Reload a changed document immediately on user clicking reload
(waiting was not related to the now fixed reload-colourise problem). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2632 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
37e0d1f3f1
commit
a86ccc6797
20
src/utils.c
20
src/utils.c
@ -278,19 +278,6 @@ gchar *utils_find_open_xml_tag(const gchar sel[], gint size, gboolean check_tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean reload_idx(gpointer data)
|
|
||||||
{
|
|
||||||
gint idx = GPOINTER_TO_INT(data);
|
|
||||||
|
|
||||||
/* check idx is still valid now we're idle, in case it was closed */
|
|
||||||
if (DOC_IDX_VALID(idx))
|
|
||||||
{
|
|
||||||
document_reload_file(idx, NULL);
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean check_reload(gint idx)
|
static gboolean check_reload(gint idx)
|
||||||
{
|
{
|
||||||
gchar *base_name = g_path_get_basename(documents[idx]->file_name);
|
gchar *base_name = g_path_get_basename(documents[idx]->file_name);
|
||||||
@ -302,10 +289,7 @@ static gboolean check_reload(gint idx)
|
|||||||
"the current buffer."), base_name);
|
"the current buffer."), base_name);
|
||||||
if (want_reload)
|
if (want_reload)
|
||||||
{
|
{
|
||||||
/* delay reloading because we need to wait for any pending scintilla messages
|
document_reload_file(idx, NULL);
|
||||||
* to be processed, otherwise the reloaded document might not be colourised
|
|
||||||
* properly */
|
|
||||||
g_idle_add(reload_idx, GINT_TO_POINTER(idx));
|
|
||||||
}
|
}
|
||||||
g_free(base_name);
|
g_free(base_name);
|
||||||
return want_reload;
|
return want_reload;
|
||||||
@ -343,7 +327,7 @@ gboolean utils_check_disk_status(gint idx, gboolean force)
|
|||||||
{
|
{
|
||||||
if (check_reload(idx))
|
if (check_reload(idx))
|
||||||
{
|
{
|
||||||
/* Disable checking until after reload, so ignore this change for now */
|
/* Update the modification time */
|
||||||
documents[idx]->mtime = st.st_mtime;
|
documents[idx]->mtime = st.st_mtime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user