[Lazarus] "Save All" button always highlighted.

Martin lazarus at mfriebe.de
Tue Aug 2 23:40:56 CEST 2011


On 02/08/2011 21:27, Zaher Dirkey wrote:
> Hi,
> When the project changed, "Save All" button highlighted to notify us 
> there is a file need to save, it is work.
> But the project changed when the current/active opened file changed 
> (change Tab of file), and who is not use to edit multiple files in one 
> project, So that make "Save All" button always highlighted.
>
> I think Save all highlighting must be responsible on files only not 
> include the project file, but when save all it must save the project file.

The logic behind it, is more complex.

Part of the project is the project session.
The project session holds information, about all open files, the order 
of tabs, the position of scrolling, caret, .... So the project session 
does remember, if you had a none project file open.

You can try and save it, and reopen the project, and the none project 
file will be opened again too.

Of course you can turn off session for "none project files" or turn off 
entirely. In that case you are right (afaik), the project does get 
marked as modified, despite it should not...

Btw the opposite is true, too. Cursor (caret) position, is saved in the 
session, but does not trigger the modified state => It is only saved if 
something else did change too.

The caret position is actually indented, otherwjise if you just open the 
project, click somewhere into the window, and close it, it will scream 
modified. So caret is saved, but does on it's own not flag modified.
- One could say the same should be true for tab switching => save = yes 
-- flag modified = no
- Then what about changing folds (fold a block, or unfold? IIRC it 
currently doesn't flag modified (yet is saved); some people already ask 
if it could flag....
    http://bugs.freepascal.org/view.php?id=18633
- not sure what scrolling does.

It's hard to impossible to get a set of rules that is consistent AND 
pleases the majority.

Yet  the current status partly is due to implementation.

Personally I thing:
- all the "VIEW" actions (tab switching, scrolling, moving caret) do not 
need to flag.
- opening.closing tabs (even if cloning / no new file) should trigger 
modified
-  folding can be seen either way...

But then again: if someone did change tabs, or did scroll, and wants to 
save it => there should be a way for him to do this.

Kind of, there would be a need for
- a "minor modified" => don't ask when closing project, but offer some 
way to save if wanted
- "modified" => the normal modified

I actually sometimes use switching tabs to mark the project as modified...
But I guess I oppose this, (I can always drag a tap to a new position, 
which definitely should mark the project as modified)


Actually dragging tabs is really complex: if it should ignore files that 
are not part of the project, because it changes the current position of 
tabs that belong to the project:
old order:  Tab-project / tab project / tab-other
new order: Tab-project / tab-other / tab project
last on changed from 2 to 3 => but, if project is reopend, the position 
2 will be empty (not part of project) and the "changed" tab falls back 
to it's original pos.....

just a few considerations on the topic...

Martin





More information about the Lazarus mailing list