bugGNU TeXmacs - Bugs: bug #37678, User is not advertised that his...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #37678: User is not advertised that his document has been modified

Submitter:  Francois Poulain <fpoulain>
Submitted:  Tue 06 Nov 2012 03:14:49 PM UTC
   
 
Category:  User Interface Priority:  3 - Low
Item Group:  Wishlist Status:  Fixed
Privacy:  Public Assigned to:  mdbenito
Originator Name:  Open/Closed:  Closed
Release:  None Release: 
Fixed Release:  None Fixed Release: 
Keywords: 

Jump to the original submission

Wed 16 Jan 2013 03:59:37 PM UTC, comment #11: 

With a couple slight modifications to avoid indices out of bounds, I committed the patch I posted. It's in SVN 6125. ==> closed.

Miguel de Benito <mdbenito>
Group Member
Mon 07 Jan 2013 12:09:18 AM UTC, comment #10: 

Here is a possibility for interpose_handler(). At first glance there seem to be no extremely expensive operations made, so we might be ok with this solution. However we could look for others. For instance using delayed commands scheduled every 500ms. Or we could use the editor hooks and also add code to the archiver and everything else that may modify a buffer. But it's easy to forget some places...


void
tm_server_rep::interpose_handler () {
#ifdef QTTEXMACS
  // TeXmacs/Qt handles delayed messages and socket notification
  // in its own runloop
#ifndef QTPIPES
  perform_select ();
#endif
  process_all_pipes ();
#else
  perform_select ();
  exec_pending_commands ();
#endif

  int i, j;
  for (i=0; i<N(bufs); i++) {
    tm_buffer buf= (tm_buffer) bufs[i];
   
    string s= buf->buf->title;
    bool tchange= false;

    if (buf->needs_to_be_saved()) {
      if (s[N(s)-1] != '*') {
        buf->buf->title = s "";
        tchange= true;
      }
    } else if (s[N(s)-1] == '*') {
      buf->buf->title= s (0, N(s)-1);
      tchange= true;
    }

    for (j=0; j<N(buf->vws); j++) {
      tm_view vw= (tm_view) buf->vws[j];
      if (vw->win != NULL) {
        vw->ed->apply_changes ();
        if (tchange) {
          vw->win->set_window_name (buf->buf->title);
          vw->win->set_window_url (buf->buf->name);
        }
      }
    }

    for (j=0; j<N(buf->vws); j++) {
      tm_view vw= (tm_view) buf->vws[j];
      if (vw->win != NULL) vw->ed->animate ();
    }
  }

  windows_refresh ();
}

Miguel de Benito <mdbenito>
Group Member
Mon 07 Jan 2013 12:08:50 AM UTC, comment #9: 

Unbelievable. Another post gone!!

Here is a possibility for interpose_handler(). At first glance there seem to be no extremely expensive operations made, so we might be ok with this solution. However we could look for others. For instance using delayed commands scheduled every 500ms. Or we could use the editor hooks and also add code to the archiver and everything else that may modify a buffer. But it's easy to forget some places...


void
tm_server_rep::interpose_handler () {
#ifdef QTTEXMACS
  // TeXmacs/Qt handles delayed messages and socket notification
  // in its own runloop
#ifndef QTPIPES
  perform_select ();
#endif
  process_all_pipes ();
#else
  perform_select ();
  exec_pending_commands ();
#endif

  int i, j;
  for (i=0; i<N(bufs); i++) {
    tm_buffer buf= (tm_buffer) bufs[i];

    string s= buf->buf->title;
    bool tchange= false;

    if (buf->needs_to_be_saved()) {
      if (s[N(s)-1] != '*') {
        buf->buf->title = s * "*";
        tchange= true;
      }
    } else if (s[N(s)-1] == '*') {
      buf->buf->title= s (0, N(s)-1);
      tchange= true;
    }

    for (j=0; j<N(buf->vws); j++) {
      tm_view vw= (tm_view) buf->vws[j];
      if (vw->win != NULL) {
        vw->ed->apply_changes ();
        if (tchange) {
          vw->win->set_window_name (buf->buf->title);
          vw->win->set_window_url (buf->buf->name);
        }
      }
    }

    for (j=0; j<N(buf->vws); j++) {
      tm_view vw= (tm_view) buf->vws[j];
      if (vw->win != NULL) vw->ed->animate ();
    }
  }

  windows_refresh ();
}
+verbatim+

Miguel de Benito <mdbenito>
Group Member
Mon 07 Jan 2013 12:06:22 AM UTC, comment #8: 


Here is a possibility for interpose_handler(). At first glance there seem to be no extremely expensive operations made, so we might be ok with this solution. However we could look for others. For instance using delayed commands scheduled every 500ms. Or we could use the editor hooks and also add code to the archiver and everything else that may modify a buffer. But it's easy to forget some places...


void
tm_server_rep::interpose_handler () {
#ifdef QTTEXMACS
  // TeXmacs/Qt handles delayed messages and socket notification
  // in its own runloop
#ifndef QTPIPES
  perform_select ();
#endif
  process_all_pipes ();
#else
  perform_select ();
  exec_pending_commands ();
#endif

  int i, j;
  for (i=0; i<N(bufs); i++) {
    tm_buffer buf= (tm_buffer) bufs[i];

    string s= buf->buf->title;
    bool tchange= false;

    if (buf->needs_to_be_saved()) {
      if (s[N(s)-1] != '*') {
        buf->buf->title = s * "*";
        tchange= true;
      }
    } else if (s[N(s)-1] == '*') {
      buf->buf->title= s (0, N(s)-1);
      tchange= true;
    }

    for (j=0; j<N(buf->vws); j++) {
      tm_view vw= (tm_view) buf->vws[j];
      if (vw->win != NULL) {
        vw->ed->apply_changes ();
        if (tchange) {
          vw->win->set_window_name (buf->buf->title);
          vw->win->set_window_url (buf->buf->name);
        }
      }
    }

    for (j=0; j<N(buf->vws); j++) {
      tm_view vw= (tm_view) buf->vws[j];
      if (vw->win != NULL) vw->ed->animate ();
    }
  }

  windows_refresh ();
}
+verbatim+

Miguel de Benito <mdbenito>
Group Member
Mon 07 Jan 2013 12:02:36 AM UTC, comment #7: 

Shit, I HATE this tracker. I lost my post again!!!

Miguel de Benito <mdbenito>
Group Member
Sun 06 Jan 2013 11:58:14 PM UTC, comment #6: 

About the lowest level we can get is in interpose_handler(), which may be modified as follows:


void
tm_server_rep::interpose_handler () {
#ifdef QTTEXMACS
  // TeXmacs/Qt handles delayed messages and socket notification
  // in its own runloop
#ifndef QTPIPES
  perform_select ();
#endif
  process_all_pipes ();
#else
  perform_select ();
  exec_pending_commands ();
#endif

  int i, j;
  for (i=0; i<N(bufs); i++) {
    tm_buffer buf= (tm_buffer) bufs[i];

    string s= buf->buf->title;
    bool tchange= false;

    if (buf->needs_to_be_saved()) {
      if (s[N(s)-1] != '*') {
        buf->buf->title = s * "*";
        tchange= true;
      }
    } else if (s[N(s)-1] == '*') {
      buf->buf->title= s (0, N(s)-1);
      tchange= true;
    }

    for (j=0; j<N(buf->vws); j++) {
      tm_view vw= (tm_view) buf->vws[j];
      if (vw->win != NULL) {
        vw->ed->apply_changes ();
        if (tchange) {
          vw->win->set_window_name (buf->buf->title);
          vw->win->set_window_url (buf->buf->name);
        }
      }
    }

    for (j=0; j<N(buf->vws); j++) {
      tm_view vw= (tm_view) buf->vws[j];
      if (vw->win != NULL) vw->ed->animate ();
    }
  }

  windows_refresh ();
}
+verbatim+

Some superficial checks tell me that there shouldn't be any significant slowdown due to the additional code being executed as often as interpose_handler, but we might want to find a better place for it. Maybe using delayed commands scheduled every 500ms or so?

Miguel de Benito <mdbenito>
Group Member
Sun 06 Jan 2013 11:31:10 PM UTC, comment #5: 

I think the problem is rather that post_notify() is only called after an edition, so you have to modify the buffer to see the new title, which implies that after a save, the * is removed only after you edit again, which is obviously not what we want.

So my suggestion was wrong. We should find another place to check for modified buffers.

Miguel de Benito <mdbenito>
Group Member
Thu 03 Jan 2013 01:11:37 PM UTC, comment #4: 


I tried this, but it doesn't work as expected. Maybe need_save () is not exactly made for this purpose. What do you think about it ?

diff --git a/src/Edit/Modify/edit_modify.cpp b/src/Edit/Modify/edit_modify.cpp
index 650c5fc..5124607 100644
--- a/src/Edit/Modify/edit_modify.cpp
+++ b/src/Edit/Modify/edit_modify.cpp
@@ -126,6 +126,18 @@ edit_modify_rep::post_notify (path p) {
   position_delete (cur_pos);
   cur_pos= nil_observer;
   go_to_correct (tp);
+
+  url buf= get_current_buffer ();
+  string s= get_title_buffer (buf);
+  if (need_save ()){
+    if (s[N(s)-1] != '*')
+      set_title_buffer (buf, s * "*");
+  }
+  else {
+    if (s[N(s)-1] == '*')
+      set_title_buffer (buf, s (0, N(s)-1));
+  }
+
   /*
   cout << "et= " << et << "\n";
   cout << "tp= " << tp << "\n\n";


Francois Poulain <fpoulain>
Group Member
Mon 31 Dec 2012 01:53:58 AM UTC, comment #3: 

(Again!)(There was a problem with the page, I must post again)
edit_modify_rep::post_notify() looks like a good place for this. Something like

  if (need_save())
    send (SLOT_NAME, close_box (as_string (buf->buf->name) " "));
  else
    send (SLOT_NAME, close_box (as_string (buf->buf->name)));

but this changes the title to the full buffer name, so we need either to implement read(SLOT_NAME) or find out how titles are composed from buffer names (seems complicated because of tmfs-title-handlers, etc.)

Miguel de Benito <mdbenito>
Group Member
Mon 31 Dec 2012 01:53:27 AM UTC, comment #2: 

(There was a problem with the page, I must post again)
edit_modify_rep::post_notify() looks like a good place for this. Something like

  if (need_save())
    send (SLOT_NAME, close_box (as_string (buf->buf->name) * " *"));
  else
    send (SLOT_NAME, close_box (as_string (buf->buf->name)));
+verbatim+
but this changes the title to the full buffer name, so we need either to implement read(SLOT_NAME) or find out how titles are composed from buffer names (seems complicated because of tmfs-title-handlers, etc.)

Miguel de Benito <mdbenito>
Group Member
Mon 31 Dec 2012 01:50:51 AM UTC, comment #1: 

edit_modify_rep::post_notify() looks like a good place for this. Something like:


  if (need_save())
    send (SLOT_NAME, close_box (as_string (buf->buf->name) * " *"));
  else
    send (SLOT_NAME, close_box (as_string (buf->buf->name)));
+verbatim+

but this changes the title to the full buffer name, so we need either to implement read(SLOT_NAME) or find out how titles are composed from buffer names (seems complicated because of tmfs-title-handlers, etc.)

Miguel de Benito <mdbenito>
Group Member
Tue 06 Nov 2012 03:14:49 PM UTC, original submission:  

Usually, when a document has been modified (compared to the saved version), the user is advertised, e.g. by preceding the name of the file by a star ('*') in the window titlebar.

Francois Poulain <fpoulain>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mdbenito (Posted a comment)
  • -email is unavailable- added by fpoulain (Submitted the item)
  • -email is unavailable- added by fpoulain
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-01-16 mdbenito StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2012-12-31 mdbenito Priority5 - Normal 3 - Low
        Item GroupNone Wishlist
        StatusNone Confirmed
        Assigned toNone mdbenito
    2012-11-06 fpoulain Carbon-Copy- Added olivier schwander <schwander@lix.polytechnique.fr>

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code