diff --git a/src/graphics/VirtualKeyboard.cpp b/src/graphics/VirtualKeyboard.cpp index 52f0195b3..43b33e853 100644 --- a/src/graphics/VirtualKeyboard.cpp +++ b/src/graphics/VirtualKeyboard.cpp @@ -142,8 +142,9 @@ void VirtualKeyboard::draw(OLEDDisplay *display, int16_t offsetX, int16_t offset if (keyboardStartY < 0) keyboardStartY = 0; } else { - // Default (non-wide, non-64px) behavior: use key height heuristic and place at bottom - cellH = KEY_HEIGHT; + // Default (non-wide, non-64px) e.g. SH1107 128x128: + // cellH = FONT_HEIGHT_SMALL - 2 so rows are tighter while still hosting the font + cellH = std::max((int)KEY_HEIGHT, FONT_HEIGHT_SMALL - 2); int keyboardHeight = KEYBOARD_ROWS * cellH; keyboardStartY = screenH - keyboardHeight; if (keyboardStartY < 0) @@ -446,11 +447,8 @@ void VirtualKeyboard::drawKey(OLEDDisplay *display, const VirtualKey &key, bool if (textX < x) textX = x; // guard } else { - if (display->getHeight() <= 64 && (key.character >= '0' && key.character <= '9')) { - textX = x + (width - textWidth + 1) / 2; - } else { - textX = x + (width - textWidth) / 2; - } + // Use ceil rounding for all screens (consistent with 128x64 behavior for numbers) + textX = x + (width - textWidth + 1) / 2; } int contentTop = y; int contentH = height; @@ -746,4 +744,4 @@ bool VirtualKeyboard::isTimedOut() const } } // namespace graphics -#endif \ No newline at end of file +#endif