~aleteoryx/muditaos

f15cbe71de391b383a0bbc3dc02a281698ac271a — PrzeBrudny 5 years ago 4ad16d7
[EGD-3409] Text boundaries fixes. (#860)

M module-gui/gui/widgets/Lines.cpp => module-gui/gui/widgets/Lines.cpp +1 -1
@@ 72,7 72,7 @@ namespace gui

        auto bound = textLine->checkBounds(cursor, code, format);
        if (bound == InputBound::CANT_PROCESS && line == scroll_position) {
            return InputBound::CANT_PROCESS;
            return InputBound::HIT_BOUND;
        }

        return InputBound::CAN_ADD;

M module-gui/gui/widgets/Text.cpp => module-gui/gui/widgets/Text.cpp +1 -2
@@ 227,7 227,7 @@ namespace gui
            lines->updateScrollPosition(scroll, factor);
        }

        if (bound != InputBound::CANT_PROCESS) {
        if (!(bound & InputBound::CANT_PROCESS)) {
            return true;
        }



@@ 379,7 379,6 @@ namespace gui

            line.setPosition(line_x_position, line_y_position);
            line.setParent(this);
            line.alignH(getAlignment(Axis::X), w);

            end = lines->last().getEnd();
            line_y_position += line.height();

M module-gui/gui/widgets/TextCursor.cpp => module-gui/gui/widgets/TextCursor.cpp +6 -2
@@ 192,11 192,15 @@ namespace gui
    InputBound TextCursor::processBound(InputBound bound, const InputEvent &event)
    {
        if (bound == InputBound::CAN_MOVE) {
            moveCursor(inputToNavigation(event));
            if (event.isShortPress()) {
                moveCursor(inputToNavigation(event));
            }
        }

        if (bound == InputBound::CAN_REMOVE) {
            removeChar();
            if (event.isShortPress()) {
                text->handleBackspace(event);
            }
        }

        if (bound == InputBound::CAN_ADD) {

M module-gui/gui/widgets/TextLine.cpp => module-gui/gui/widgets/TextLine.cpp +1 -1
@@ 293,7 293,7 @@ namespace gui
        auto text = getText(0);
        text.insertCode(utf_value);

        if ((width_used + font->getPixelWidth(text)) <= max_width) {
        if ((font->getPixelWidth(text)) <= max_width) {
            return InputBound::CAN_ADD;
        }