I've noticed that after applying setModified through the netbeans
interface, the tab bar, status bar and title are not updated to reflect
the changed modified status.
The proposed patch fixes that. I am a beginner in vim development, so
tell me if it's not the correct way to get the gui updated.
cheers,
Philippe
Thanks for the patch. I think it makes sense to check if the modified
flag actually changed. How about this patch instead:
*** ../vim-7.1.298/src/netbeans.c Sun Mar 16 16:02:47 2008
--- src/netbeans.c Tue May 27 21:14:12 2008
***************
*** 1974,1986 ****
}
else if (streq((char *)cmd, "setModified"))
{
if (buf == NULL || buf->bufp == NULL)
{
/* EMSG("E646: null bufp in setModified"); */
return FAIL;
}
if (streq((char *)args, "T"))
! buf->bufp->b_changed = 1;
else
{
struct stat st;
--- 1978,1993 ----
}
else if (streq((char *)cmd, "setModified"))
{
+ int prev_b_changed;
+
if (buf == NULL || buf->bufp == NULL)
{
/* EMSG("E646: null bufp in setModified"); */
return FAIL;
}
+ prev_b_changed = buf->bufp->b_changed;
if (streq((char *)args, "T"))
! buf->bufp->b_changed = TRUE;
else
{
struct stat st;
***************
*** 1990,1998 ****
if (buf->bufp->b_ffname != NULL
&& mch_stat((char *)buf->bufp->b_ffname, &st) >= 0)
buf_store_time(buf->bufp, &st, buf->bufp->b_ffname);
! buf->bufp->b_changed = 0;
}
buf->modified = buf->bufp->b_changed;
/* =====================================================================*/
}
else if (streq((char *)cmd, "setModtime"))
--- 1997,2016 ----
if (buf->bufp->b_ffname != NULL
&& mch_stat((char *)buf->bufp->b_ffname, &st) >= 0)
buf_store_time(buf->bufp, &st, buf->bufp->b_ffname);
! buf->bufp->b_changed = FALSE;
}
buf->modified = buf->bufp->b_changed;
+ if (prev_b_changed != buf->bufp->b_changed)
+ {
+ #ifdef FEAT_WINDOWS
+ check_status(buf);
+ redraw_tabline = TRUE;
+ #endif
+ #ifdef FEAT_TITLE
+ maketitle();
+ #endif
+ update_screen(0);
+ }
/* =====================================================================*/
}
else if (streq((char *)cmd, "setModtime"))
--
SOLDIER: What? Ridden on a horse?
ARTHUR: Yes!
SOLDIER: You're using coconuts!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Good idea.
Your patch works, except for check_status(buf) which should be
check_status( buf->bufp ).
buf is a netbeans buffer structure and buf->bufp is a vim buffer structure.
What surprises me is that the compiler casts beween different pointers
without even a warning.
Attached is the final correct patch, with your modifications.
cheers,
Philippe
Thanks for fixing my mistake.
--
"I've been teaching myself to play the piano for about 5 years and now write
most of my songs on it, mainly because I can never find any paper."
Jeff Lynne, ELO's greatest hits