Ticket #17401: 17401.patch

File 17401.patch, 859 bytes (added by GerdP, 6 years ago)
  • src/org/openstreetmap/josm/data/UndoRedoHandler.java

     
    316316     */
    317317    public void afterAdd(List<? extends Command> cmds) {
    318318        if (cmds != null) {
    319             for (Command cmd : cmds) {
    320                 fireEvent(new CommandAddedEvent(this, cmd));
     319            int n = cmds.size();
     320            // performance: only add the last commands if the list is longer than the max allowed
     321            for (int i = Math.max(0, n - Config.getPref().getInt("undo.max", 1000)); i < n; i++) {
     322                fireEvent(new CommandAddedEvent(this, cmds.get(i)));
    321323            }
    322324        }
    323325        fireCommandsChanged();