Skip to content

Commit

Permalink
fix changed db items being offset by 1
Browse files Browse the repository at this point in the history
  • Loading branch information
lumiscosity committed Dec 15, 2024
1 parent 9fa9e98 commit 7ba0ca5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pickerwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ class PickerWidget : public QDialog {
// note non-empty additions in new chunks
for (int i = orig.size(); i <= work.size(); i++) {
if (work[i-1] != T()) {
addModelItem(folder, lcfops::id_with_name(i-1, ToQString(work[i-1].name)), "+", 1);
addModelItem(folder, lcfops::id_with_name(i+1, ToQString(work[i-1].name)), "+", 1);
}
}
} else if (orig.size() > work.size()) {
// note non-empty removals in removed chunks
for (int i = work.size(); i <= orig.size(); i++) {
if (orig[i-1] != T()) {
addModelItem(folder, lcfops::id_with_name(i-1, ToQString(orig[i-1].name)), "i", 1);
addModelItem(folder, lcfops::id_with_name(i+1, ToQString(orig[i-1].name)), "i", 1);
}
}
}
Expand All @@ -68,9 +68,9 @@ class PickerWidget : public QDialog {
if (orig[i] != work[i]) {
QString comp = lcfops::compare<T>(orig[i], work[i]);
if (comp == "-") {
addModelItem(folder, lcfops::id_with_name(i, ToQString(orig[i].name)), comp, 1);
addModelItem(folder, lcfops::id_with_name(i+1, ToQString(orig[i].name)), comp, 1);
} else {
addModelItem(folder, lcfops::id_with_name(i, ToQString(work[i].name)), comp, 1);
addModelItem(folder, lcfops::id_with_name(i+1, ToQString(work[i].name)), comp, 1);
}
}
}
Expand Down

0 comments on commit 7ba0ca5

Please sign in to comment.