Skip to content

Commit f197d8e

Browse files
committed
fix(input): potential bad clamping of cursor height
1 parent 37850e2 commit f197d8e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/ui/controls/input.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,8 @@ void Input::updateInteractiveGeometry() {
923923

924924
const float controlHeight = height() > 0.0f ? height() : m_controlHeight;
925925
const float maxCursorHeight = std::max(0.0f, controlHeight - kCursorPadV * 2.0f);
926-
const float cursorHeight = std::clamp(controlHeight * kCursorHeightRatio, kCursorMinHeight, maxCursorHeight);
926+
const float cursorHeight =
927+
std::clamp(controlHeight * kCursorHeightRatio, std::min(kCursorMinHeight, maxCursorHeight), maxCursorHeight);
927928
const float cursorY = std::round((controlHeight - cursorHeight) * 0.5f);
928929
const float cursorX = stopXForByte(m_cursorPos) - m_scrollOffset + m_contentLeadSlack;
929930
m_cursor->setPosition(cursorX, cursorY);

0 commit comments

Comments
 (0)