Ticket #4261: undo-selection-fix.diff

File undo-selection-fix.diff, 2.2 KB (added by KalleLampila, 14 years ago)
  • src/org/openstreetmap/josm/data/UndoRedoHandler.java

    diff --git a/src/org/openstreetmap/josm/data/UndoRedoHandler.java b/src/org/openstreetmap/josm/data/UndoRedoHandler.java
    index fb7ef80..fd3874c 100644
    a b public class UndoRedoHandler implements MapView.LayerChangeListener {  
    6565    public void undo() {
    6666        if (commands.isEmpty())
    6767            return;
    68         Collection<? extends OsmPrimitive> oldSelection = Main.main.getCurrentDataSet().getSelected();
    6968        final Command c = commands.removeLast();
    7069        c.undoCommand();
    7170        redoCommands.push(c);
    public class UndoRedoHandler implements MapView.LayerChangeListener {  
    7473            data.fireDataChange();
    7574        }
    7675        fireCommandsChanged();
    77         Collection<? extends OsmPrimitive> newSelection = Main.main.getCurrentDataSet().getSelected();
    78         if (!oldSelection.equals(newSelection)) {
    79             Main.main.getCurrentDataSet().fireSelectionChanged();
    80         }
     76        // the undo may have changed the selection or modify selected items
     77        // so tell the listeners about the current situation
     78        Main.main.getCurrentDataSet().fireSelectionChanged();
    8179    }
    8280
    8381    /**
    public class UndoRedoHandler implements MapView.LayerChangeListener {  
    8785    public void redo() {
    8886        if (redoCommands.isEmpty())
    8987            return;
    90         Collection<? extends OsmPrimitive> oldSelection = Main.main.getCurrentDataSet().getSelected();
    9188        final Command c = redoCommands.pop();
    9289        c.executeCommand();
    9390        commands.add(c);
    public class UndoRedoHandler implements MapView.LayerChangeListener {  
    9693            data.fireDataChange();
    9794        }
    9895        fireCommandsChanged();
    99         Collection<? extends OsmPrimitive> newSelection = Main.main.getCurrentDataSet().getSelected();
    100         if (!oldSelection.equals(newSelection)) {
    101             Main.main.getCurrentDataSet().fireSelectionChanged();
    102         }
     96        // the redo may have changed the selection or modify selected items
     97        // so tell the listeners about the current situation
     98        Main.main.getCurrentDataSet().fireSelectionChanged();
    10399    }
    104100
    105101    public void fireCommandsChanged() {