Bram Moolenaar wrote:
> 
> Philippe Fremy wrote:
> 
>> 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.
> 
> Thanks for the patch.  I think it makes sense to check if the modified
> flag actually changed.  How about this patch instead:

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

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: netbeans.c
===================================================================
*** netbeans.c  (revision 1011)
--- netbeans.c  (working copy)
***************
*** 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;
--- 1974,1989 ----
        }
        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"))
--- 1993,2012 ----
                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->bufp);
+               redraw_tabline = TRUE;
+ #endif
+ #ifdef FEAT_TITLE
+               maketitle();
+ #endif
+               update_screen(0);
+           }
  /* =====================================================================*/
        }
        else if (streq((char *)cmd, "setModtime"))

Raspunde prin e-mail lui