mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-11 09:40:42 +00:00
Don't scroll Entry text if it isn't needed
This commit is contained in:
parent
f954556683
commit
721734d26c
@ -309,7 +309,7 @@ bool Entry::onProcessMessage(Message* msg)
|
||||
}
|
||||
// Forward scroll
|
||||
else if (mousePos.x >= getBounds().x2()) {
|
||||
if (m_scroll < textlen) {
|
||||
if (m_scroll < textlen - getAvailableTextLength()) {
|
||||
m_scroll++;
|
||||
x = getBounds().x + this->border_width.l;
|
||||
for (c=m_scroll; utf8_begin != utf8_end; ++c) {
|
||||
@ -682,4 +682,9 @@ void Entry::backwardWord()
|
||||
m_caret = 0;
|
||||
}
|
||||
|
||||
int Entry::getAvailableTextLength()
|
||||
{
|
||||
return getClientChildrenBounds().w / ji_font_char_len(getFont(), 'w');
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -77,6 +77,7 @@ namespace ui {
|
||||
void executeCmd(EntryCmd::Type cmd, int ascii, bool shift_pressed);
|
||||
void forwardWord();
|
||||
void backwardWord();
|
||||
int getAvailableTextLength();
|
||||
|
||||
size_t m_maxsize;
|
||||
int m_caret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user