mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-18 21:40:46 +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
|
// Forward scroll
|
||||||
else if (mousePos.x >= getBounds().x2()) {
|
else if (mousePos.x >= getBounds().x2()) {
|
||||||
if (m_scroll < textlen) {
|
if (m_scroll < textlen - getAvailableTextLength()) {
|
||||||
m_scroll++;
|
m_scroll++;
|
||||||
x = getBounds().x + this->border_width.l;
|
x = getBounds().x + this->border_width.l;
|
||||||
for (c=m_scroll; utf8_begin != utf8_end; ++c) {
|
for (c=m_scroll; utf8_begin != utf8_end; ++c) {
|
||||||
@ -682,4 +682,9 @@ void Entry::backwardWord()
|
|||||||
m_caret = 0;
|
m_caret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Entry::getAvailableTextLength()
|
||||||
|
{
|
||||||
|
return getClientChildrenBounds().w / ji_font_char_len(getFont(), 'w');
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ui
|
} // namespace ui
|
||||||
|
@ -77,6 +77,7 @@ namespace ui {
|
|||||||
void executeCmd(EntryCmd::Type cmd, int ascii, bool shift_pressed);
|
void executeCmd(EntryCmd::Type cmd, int ascii, bool shift_pressed);
|
||||||
void forwardWord();
|
void forwardWord();
|
||||||
void backwardWord();
|
void backwardWord();
|
||||||
|
int getAvailableTextLength();
|
||||||
|
|
||||||
size_t m_maxsize;
|
size_t m_maxsize;
|
||||||
int m_caret;
|
int m_caret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user