﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
6162	Trouble saving multiple changes when working with single-file packages	Philip Hannebohm	Adeel Asghar	"A student found this confusing behavior while working with a package in a single file.

Steps to reproduce:
1. Open file `P.mo` in OMEdit
2. Open models `A` and `B` in the tab-view
3. Edit both
4. Save `A`
5. Observe that the change in `B` is lost

{{{#!modelica
// P.mo
package P
  model A
    // make some change here
  end A;
  model B
    // make some change here
  end B;
end P;
}}}

I would expect the change in `B` to remain in the editor. But It would already be less frustrating if OMEdit at least notifies the user that it is about to throw away unsaved changes from other tabs instead of silently reloading those other tabs. It's really not a problem once you get used to saving before you switch tabs, but it took us quite some time to identify and understand this behavior.

I'm aware that it could get difficult in cases where the contents of the two tabs ""overlap"", e.g. when the models are nested within each other like
{{{#!modelica
model A
  //...
  model B
    //...
  end B;
end A;
}}}
OMEdit would need to detect if the change in `A` also affects `B`. Could this be done by checking the line numbers of opened tabs/changed lines?

The ideal behavior, I think, would be:
* If the changes don't overlap, just save the change in `A` but keep the change in `B` in the editor.
* If the changes do overlap, tell the user that there is a ""merge conflict"" and ask which change to keep (possibly with a ""don't ask me again, always do it like this"" checkbox). A proper diff-tool might be overkill here."	defect	closed	blocker	1.17.0	OMEdit		fixed		Francesco Casella
