switch_focus
iterates from the last focusable line to _lineCount
instead of the first line
#67
Replies: 6 comments
-
I also noticed this issue. Can you make a pull request of your fix @DarioMaechler? |
Beta Was this translation helpful? Give feedback.
-
I turned it into pull request #39 It can be installed into platformio until this is released (or fixed differently) using:
Can you review the pull request @VaSe7u? |
Beta Was this translation helpful? Give feedback.
-
Hello, @DarioMaechler and @thijstriemstra. This is intended by design for the purely aesthetic purpose of not showing the focus indicator when it's not used. Thank's for the input. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback.
I see. I think the default should not be the aesthetic version since it's confusing IMO, I thought my code/board was buggy. An option sounds good though. |
Beta Was this translation helpful? Give feedback.
-
Thanks to both of you as well. I agree with @thijstriemstra. Based on the method names and the comments in the declaration I find the behavior confusing as well. Small example illustrating the problem:
In my logic the getter returns an illegal value if the setter for the same item won't accept that same value. |
Beta Was this translation helpful? Give feedback.
-
Hello and sorry for the delay. I thought about it and I agree that hiding the indicator while iterating the focusable lines really is confusing and this is not an intuitive place to put that functionality in. I decided to make this side effect compile time configurable though a define inside src/LiquidMenu_config.h: Thank you for the input and the help with the code modification needed. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
When iterating through the selected lines on a screen with next_screen() (forward/backward same issue), the last selected line is the line at _lineCount, except this line doesn't actually exist - so the cursor disappears for one line.
To Reproduce
After noticing the bug I tried the J_scrolling_menu-example, with the following changes:
Bug occures in the example as well. Simply execute the function and watch the cursor disappear for 1 iteration.
Related code
// to solve the bug, I replaced all occurances of "_lineCount" in the following functions in
//LiquidScreen.cpp. I did NOT check if this breaks something else.
void LiquidScreen::switch_focus(bool forward) {
print_me(reinterpret_cast<uintptr_t>(this));
do {
if (forward) {
if (_focus < _lineCount -1) {
_focus++;
if (_focus == _lineCount-1) {
break;
}
} else {
_focus = 0;
}
} else { //else (forward)
if (_focus == 0) {
_focus = _lineCount-1;
break;
} else {
_focus--;
}
} //else (forward)
} while (_p_liquidLine[_focus]->_focusable == false);
DEBUG(F("Focus switched to ")); DEBUGLN(_focus);
}
Version of the library
V1.5.1
Beta Was this translation helpful? Give feedback.
All reactions