bugGNU Octave - Bugs: bug #45273, GUI editor does not attempt to...

 
 

bug #45273: GUI editor does not attempt to save the modified contents of unnamed files at close

Submitted by:  Dan Sebald <sebald>
Submitted on:  Mon 08 Jun 2015 06:24:54 AM UTC  
 
Category: GUISeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: Works For MeAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 09 Jun 2015 03:52:13 PM UTC, comment #4:

The fix is part of the changeset attached here:

https://savannah.gnu.org/bugs/?44485

This report can be closed.

Dan Sebald <sebald>
Mon 08 Jun 2015 10:01:06 PM UTC, comment #3:

If you have a fix already in the works then I think you can close this report.

Rik <rik5>
Project Administrator
Mon 08 Jun 2015 06:47:05 PM UTC, comment #2:

I guess this does work in a dev build. I broke something (and fixed differently) with my edits. There is still a small bug here, however. Try what you did once again--naming the files test1.m, test2.m--then relaunch Octave and the files will not be in the editor. My thinking is that those files should be restored as they were never specifically closed. Could rename this report to: "GUI editor does not restore unnamed files saved at close". Or, just mark as not-a-problem as I doubt anyone will report or search for such a subtle bug and this will be addressed shortly. Right now, the filename list is built and saved just prior to save/confirm process, but that should be repeated right after the save/confirm process.

Dan Sebald <sebald>
Mon 08 Jun 2015 05:57:37 PM UTC, comment #1:

Is this actually a problem? With both 4.0.0 and the dev branch I get a save dialog for each unnamed file.

Steps:

Rik <rik5>
Project Administrator
Mon 08 Jun 2015 06:24:54 AM UTC, original submission:

I'm in the process of reworking the quit/exit code for another bug report, and I noticed that changes in a new tab, i.e., one for which the tab is labelled "* <unnamed>", are not inquired to save when the GUI editor closes at exit. I've fixed this in the code I'm working on. I can leave the fix for this as part of the changeset I'm about to wrap up, or create a separate one. Any preference?

I will summarize the problem and solution:

The way the editor works at save/confirm is to create a list/table of the files and tab IDs by querying all the tabs, then step through the list processing the tabs for which the contents has been changed. However, the file_editor_tab does not report unnamed files:

Well, the logical approach is to simply to remove that conditional test at the end of the function and always add the file name. That works, except for another required change. Adding the file name is as follows:

Since the file name for all unnamed files is empty, that means if there are multiple "* <unnamed>" files then the fileName is not unique and all but one of the unnamed files is lost.

On the other hand, ID is unique. So the solution is to swap the roles of fileName and ID. That is, make ID the independent variable:

and then of course swap p->first and p->second in the use of the iterator.

Dan Sebald <sebald>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by sebald (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 09 Jun 2015 04:32:17 PM UTCrik5Open/ClosedOpen=>Closed
    Mon 08 Jun 2015 05:57:37 PM UTCrik5StatusNone=>Works For Me

    Back to the top


    Powered by Savane 3.1-cleanup1