tboegi / GpsMaster

https://wiki.openstreetmap.org/wiki/GpsMaster
GNU General Public License v2.0
46 stars 7 forks source link

Undo loses current selection #5

Open john-h-kastner opened 4 years ago

john-h-kastner commented 4 years ago

Clicking undo while editing a route causes the route to no longer be selected. The is a particular issue in my workflow where I am adding points to a route, make a mistake, undo the mistake, and would then like to continue where I left off without reselecting the route in in the side bar.

Steps to Reproduce

  1. Create a new GPX file
  2. Create some new points
  3. Click "Undo"
  4. Attempt to add more points.
  5. Notice that you cannot do this, and the buttons for doing this have be deactivate.

Proposed Solution

If I comment out the call to setActiveGpx on line 509 fo ActiveGpxObjects.java, I get the behavior I want. https://github.com/tboegi/GpsMaster/blob/c8d1d57e519cdd9fc968106b1a99668390fe5452/GpsMaster/src/org/gpsmaster/ActiveGpxObjects.java#L507-L511

I'm using this fix at any rate, but I think it's not the best way to go. The call to getLastSelectedPathComponent() is coming up null for some reason, and this would ideally be resolved. It is also likely that that setActiveGpx(null) should be called sometimes.