commit | ceedc64adfe9b4038f9599873d38aece75e2c3a2 | [log] [tgz] |
---|---|---|
author | Ole Rehmsen <oler@google.com> | Mon Apr 06 13:14:48 2020 +0200 |
committer | Ole Rehmsen <oler@google.com> | Mon Apr 06 13:15:14 2020 +0200 |
tree | 72b6be701be8e3919a6d56424a772ab8b7e5d13d | |
parent | 28d972adcb30079fa193f3ee66d256769e6e8884 [diff] |
Fix conditional cursor iteration It's okay to keep going when at the first element if we go forward, and when at the last element if we are going backwards. Change-Id: Ibf06b8b2133b3436e44fc687c6a52159637cae3b
diff --git a/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js b/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js index 37c3d52..222109e 100644 --- a/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js +++ b/polygerrit-ui/app/elements/shared/gr-cursor-manager/gr-cursor-manager.js
@@ -337,8 +337,8 @@ } do { newIndex = newIndex + delta; - } while (newIndex > 0 && - newIndex < this.stops.length - 1 && + } while ((delta > 0 || newIndex > 0) && + (delta < 0 || newIndex < this.stops.length - 1) && opt_condition && !opt_condition(this.stops[newIndex])); newIndex = Math.max(0, Math.min(this.stops.length - 1, newIndex));