diff options
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 5f86f5bf..6719fb40 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -658,12 +658,12 @@ void setCursor_InputWidget(iInputWidget *d, size_t pos) { | |||
658 | } | 658 | } |
659 | 659 | ||
660 | static size_t indexForRelativeX_InputWidget_(const iInputWidget *d, int x, const iInputLine *line) { | 660 | static size_t indexForRelativeX_InputWidget_(const iInputWidget *d, int x, const iInputLine *line) { |
661 | size_t index = line->offset; | ||
661 | if (x <= 0) { | 662 | if (x <= 0) { |
662 | return line->offset; | 663 | return index; |
663 | } | 664 | } |
664 | const char *endPos; | 665 | const char *endPos; |
665 | tryAdvanceNoWrap_Text(d->font, range_String(&line->text), x, &endPos); | 666 | tryAdvanceNoWrap_Text(d->font, range_String(&line->text), x, &endPos); |
666 | size_t index = line->offset; | ||
667 | if (endPos == constEnd_String(&line->text)) { | 667 | if (endPos == constEnd_String(&line->text)) { |
668 | index += length_String(&line->text); | 668 | index += length_String(&line->text); |
669 | } | 669 | } |
@@ -691,10 +691,10 @@ static iBool moveCursorByLine_InputWidget_(iInputWidget *d, int dir) { | |||
691 | } | 691 | } |
692 | if (newCursor != iInvalidPos) { | 692 | if (newCursor != iInvalidPos) { |
693 | /* Clamp it to the current line. */ | 693 | /* Clamp it to the current line. */ |
694 | newCursor = iMax(newCursor, line->offset); | ||
695 | newCursor = iMin(newCursor, line->offset + length_String(&line->text) - | 694 | newCursor = iMin(newCursor, line->offset + length_String(&line->text) - |
696 | /* last line is allowed to go to the cursorMax */ | 695 | /* last line is allowed to go to the cursorMax */ |
697 | ((const void *) line < constAt_Array(&d->lines, numLines - 1) ? 1 : 0)); | 696 | ((const void *) line < constAt_Array(&d->lines, numLines - 1) ? 1 : 0)); |
697 | newCursor = iMax(newCursor, line->offset); | ||
698 | setCursor_InputWidget(d, newCursor); | 698 | setCursor_InputWidget(d, newCursor); |
699 | return iTrue; | 699 | return iTrue; |
700 | } | 700 | } |
@@ -1311,7 +1311,7 @@ static void draw_InputWidget_(const iInputWidget *d) { | |||
1311 | .x; | 1311 | .x; |
1312 | fillRect_Paint(&p, | 1312 | fillRect_Paint(&p, |
1313 | (iRect){ addX_I2(drawPos, iMin(m1, m2)), | 1313 | (iRect){ addX_I2(drawPos, iMin(m1, m2)), |
1314 | init_I2(iAbs(m2 - m1), lineHeight_Text(d->font)) }, | 1314 | init_I2(iMax(gap_UI / 3, iAbs(m2 - m1)), lineHeight_Text(d->font)) }, |
1315 | uiMarked_ColorId); | 1315 | uiMarked_ColorId); |
1316 | } | 1316 | } |
1317 | } | 1317 | } |