Fix help + X3 layout issue

This commit is contained in:
jpirnay
2026-04-15 19:02:20 +02:00
parent 5879ef8778
commit dae0ed81ba
@@ -296,7 +296,7 @@ void KeyboardEntryActivity::loop() {
void KeyboardEntryActivity::render(RenderLock&&) { void KeyboardEntryActivity::render(RenderLock&&) {
renderer.clearScreen(); renderer.clearScreen();
const Rect contentRect = UITheme::getContentRect(renderer, true, false); const Rect contentRect = UITheme::getContentRect(renderer, true, true);
const int pageWidth = contentRect.width; const int pageWidth = contentRect.width;
const int pageHeight = contentRect.height; const int pageHeight = contentRect.height;
const int contentX = contentRect.x; const int contentX = contentRect.x;
@@ -375,11 +375,12 @@ void KeyboardEntryActivity::render(RenderLock&&) {
helpTexts[2] = tr(STR_KEYBOARD_HELP_DEFAULT_LINE_3); helpTexts[2] = tr(STR_KEYBOARD_HELP_DEFAULT_LINE_3);
} }
const int helpTop = inputStartY + inputHeight + metrics.verticalSpacing; const int helpGap = keyboardStartY - (inputStartY + inputHeight);
const int helpHeight = keyboardStartY - helpTop;
const int helpLineHeight = renderer.getLineHeight(SMALL_FONT_ID); const int helpLineHeight = renderer.getLineHeight(SMALL_FONT_ID);
const int maxHelpLines = std::max(0, helpHeight / helpLineHeight); const int maxHelpLines = std::max(0, helpGap / helpLineHeight);
const int helpLineCount = std::min(3, maxHelpLines); const int helpLineCount = std::min(3, maxHelpLines);
const int helpBodyHeight = helpLineCount * helpLineHeight;
const int helpTop = inputStartY + inputHeight + std::max(0, (helpGap - helpBodyHeight) / 2);
const int helpLineWidth = pageWidth - 2 * metrics.contentSidePadding; const int helpLineWidth = pageWidth - 2 * metrics.contentSidePadding;
for (int i = 0; i < helpLineCount; ++i) { for (int i = 0; i < helpLineCount; ++i) {
const char* helpText = helpTexts[i]; const char* helpText = helpTexts[i];
@@ -422,6 +423,9 @@ void KeyboardEntryActivity::render(RenderLock&&) {
} else { } else {
cursorPixelX = contentX + effectiveMargin + beforeWidth; cursorPixelX = contentX + effectiveMargin + beforeWidth;
} }
if (cursorPos == static_cast<size_t>(lineEndIdx) && cursorPos == displayText.length()) {
cursorPixelX += 2;
}
cursorLineY = inputStartY + inputHeight; cursorLineY = inputStartY + inputHeight;
cursorDrawn = true; cursorDrawn = true;
isCursorLine = true; isCursorLine = true;