*Fix history limit

This commit is contained in:
Jesse Boyd 2016-06-29 01:56:56 +10:00
parent a521cb9ac3
commit ff59a61046

View File

@ -212,7 +212,6 @@ public class LocalSession {
if (editSession.size() == 0 || editSession.hasFastMode()) { if (editSession.size() == 0 || editSession.hasFastMode()) {
return; return;
} }
System.out.println("SIZE: " + historySize + " | " + history.size());
// Destroy any sessions after this undo point // Destroy any sessions after this undo point
if (append) { if (append) {
while (historyPointer < history.size()) { while (historyPointer < history.size()) {
@ -229,7 +228,7 @@ public class LocalSession {
history.add(0, editSession); history.add(0, editSession);
historyPointer++; historyPointer++;
} }
while ((history.size() > MAX_HISTORY_SIZE || historySize > limitMb) && history.size() > 0) { while ((history.size() > MAX_HISTORY_SIZE || historySize < limitMb) && history.size() > 1) {
EditSession item = history.get(0); EditSession item = history.get(0);
historySize -= MainUtil.getSizeInMemory(item.getChangeSet()); historySize -= MainUtil.getSizeInMemory(item.getChangeSet());
history.remove(0); history.remove(0);