summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/inputwidget.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index ceeeb475..8ed52022 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -535,6 +535,7 @@ static void updateLine_InputWidget_(iInputWidget *d, iInputLine *line) {
535 } 535 }
536 const iTextMetrics tm = measure_WrapText(&wrapText, d->font); 536 const iTextMetrics tm = measure_WrapText(&wrapText, d->font);
537 line->wrapLines.end = line->wrapLines.start + height_Rect(tm.bounds) / lineHeight_Text(d->font); 537 line->wrapLines.end = line->wrapLines.start + height_Rect(tm.bounds) / lineHeight_Text(d->font);
538 iAssert(!isEmpty_Range(&line->wrapLines));
538} 539}
539 540
540static void updateLineRangesStartingFrom_InputWidget_(iInputWidget *d, int y) { 541static void updateLineRangesStartingFrom_InputWidget_(iInputWidget *d, int y) {
@@ -1298,8 +1299,8 @@ static iInt2 coordCursor_InputWidget_(const iInputWidget *d, iInt2 coord) {
1298 1299
1299static iBool copy_InputWidget_(iInputWidget *d, iBool doCut) { 1300static iBool copy_InputWidget_(iInputWidget *d, iBool doCut) {
1300 if (!isEmpty_Range(&d->mark)) { 1301 if (!isEmpty_Range(&d->mark)) {
1301 const iRanges m = mark_InputWidget_(d); 1302 const iRanges m = mark_InputWidget_(d);
1302 iString *str = collectNew_String(); 1303 iString * str = collectNew_String();
1303 mergeLinesRange_(&d->lines, m, str); 1304 mergeLinesRange_(&d->lines, m, str);
1304 SDL_SetClipboardText( 1305 SDL_SetClipboardText(
1305 cstr_String(d->inFlags & isUrl_InputWidgetFlag ? canonicalUrl_String(str) : str)); 1306 cstr_String(d->inFlags & isUrl_InputWidgetFlag ? canonicalUrl_String(str) : str));
@@ -1868,7 +1869,7 @@ static void draw_InputWidget_(const iInputWidget *d) {
1868 drawRange_Text(d->font, drawPos, uiAnnotation_ColorId, range_String(&d->hint)); 1869 drawRange_Text(d->font, drawPos, uiAnnotation_ColorId, range_String(&d->hint));
1869 } 1870 }
1870 else { 1871 else {
1871 /* TODO: Make a function out of this. */ 1872 iAssert(~d->inFlags & isSensitive_InputWidgetFlag || size_Range(&visLines) == 1);
1872 drawPos.y += visLineOffsetY; 1873 drawPos.y += visLineOffsetY;
1873 iMarkPainter marker = { 1874 iMarkPainter marker = {
1874 .paint = &p, 1875 .paint = &p,
@@ -1876,14 +1877,13 @@ static void draw_InputWidget_(const iInputWidget *d) {
1876 .contentBounds = contentBounds, 1877 .contentBounds = contentBounds,
1877 .mark = mark_InputWidget_(d) 1878 .mark = mark_InputWidget_(d)
1878 }; 1879 };
1879 iAssert(~d->inFlags & isSensitive_InputWidgetFlag || size_Range(&visLines) == 1); 1880 wrapText.context = ▮
1881 wrapText.wrapFunc = isFocused ? draw_MarkPainter_ : NULL; /* mark is drawn under each line of text */
1880 for (size_t vis = visLines.start; vis < visLines.end; vis++) { 1882 for (size_t vis = visLines.start; vis < visLines.end; vis++) {
1881 const iInputLine *line = constAt_Array(&d->lines, vis); 1883 const iInputLine *line = constAt_Array(&d->lines, vis);
1882 wrapText.text = range_String(&line->text); 1884 wrapText.text = range_String(&line->text);
1883 wrapText.wrapFunc = isFocused ? draw_MarkPainter_ : NULL; /* mark is drawn under each line of text */ 1885 marker.line = line;
1884 wrapText.context = &marker; 1886 marker.pos = drawPos;
1885 marker.line = line;
1886 marker.pos = drawPos;
1887 addv_I2(&drawPos, draw_WrapText(&wrapText, d->font, drawPos, fg).advance); /* lines end with \n */ 1887 addv_I2(&drawPos, draw_WrapText(&wrapText, d->font, drawPos, fg).advance); /* lines end with \n */
1888 } 1888 }
1889 wrapText.wrapFunc = NULL; 1889 wrapText.wrapFunc = NULL;