mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 12:34:55 +02:00
Fix text edits wrapping
This commit is contained in:
@@ -368,7 +368,7 @@ void UITextEdit::removeCharacter(bool right)
|
||||
|
||||
void UITextEdit::wrapText()
|
||||
{
|
||||
m_text = m_font->wrapText(m_text, getPaddingRect().width());
|
||||
setText(m_font->wrapText(m_text, getPaddingRect().width()));
|
||||
}
|
||||
|
||||
void UITextEdit::moveCursor(bool right)
|
||||
@@ -427,7 +427,8 @@ void UITextEdit::onHoverChange(bool hovered)
|
||||
|
||||
void UITextEdit::onTextChange(const std::string& text, const std::string& oldText)
|
||||
{
|
||||
m_cursorPos = text.length();
|
||||
if(m_cursorPos > (int)text.length())
|
||||
m_cursorPos = text.length();
|
||||
blinkCursor();
|
||||
update(true);
|
||||
UIWidget::onTextChange(text, oldText);
|
||||
@@ -435,7 +436,7 @@ void UITextEdit::onTextChange(const std::string& text, const std::string& oldTex
|
||||
|
||||
void UITextEdit::onFontChange(const std::string& font)
|
||||
{
|
||||
update();
|
||||
update(true);
|
||||
UIWidget::onFontChange(font);
|
||||
}
|
||||
|
||||
@@ -464,7 +465,7 @@ void UITextEdit::onStyleApply(const std::string& styleName, const OTMLNodePtr& s
|
||||
|
||||
void UITextEdit::onGeometryChange(const Rect& oldRect, const Rect& newRect)
|
||||
{
|
||||
update();
|
||||
update(true);
|
||||
UIWidget::onGeometryChange(oldRect, newRect);
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,7 @@ private:
|
||||
|
||||
public:
|
||||
void setCursorPos(int pos);
|
||||
void setCursorVisible(bool enable) { m_cursorVisible = false; }
|
||||
void setCursorVisible(bool enable) { m_cursorVisible = enable; }
|
||||
void setTextHidden(bool hidden);
|
||||
void setValidCharacters(const std::string validCharacters) { m_validCharacters = validCharacters; }
|
||||
void setShiftNavigation(bool enable) { m_shiftNavigation = enable; }
|
||||
|
Reference in New Issue
Block a user