diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-20 18:58:52 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-20 18:58:52 +0300 |
commit | d3d15b308b05b0cead00b0adba20f6bee172341d (patch) | |
tree | 4c857e24cc9bebc376ac1c149794793d6fb9ccfe /src/ui/documentwidget.c | |
parent | fabff758122481dab88d13258db191980a90b678 (diff) |
Improved text selection starting on empty space
IssueID #4
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index ac37bb01..735a7214 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1620,6 +1620,9 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
1620 | else if (loc) { | 1620 | else if (loc) { |
1621 | d->selectMark.end = loc; | 1621 | d->selectMark.end = loc; |
1622 | } | 1622 | } |
1623 | // printf("mark %zu ... %zu\n", d->selectMark.start - cstr_String(source_GmDocument(d->doc)), | ||
1624 | // d->selectMark.end - cstr_String(source_GmDocument(d->doc))); | ||
1625 | // fflush(stdout); | ||
1623 | refresh_Widget(w); | 1626 | refresh_Widget(w); |
1624 | return iTrue; | 1627 | return iTrue; |
1625 | } | 1628 | } |
@@ -1705,7 +1708,8 @@ static void fillRange_DrawContext_(iDrawContext *d, const iGmRun *run, enum iCol | |||
1705 | /* Selection may be done in either direction. */ | 1708 | /* Selection may be done in either direction. */ |
1706 | iSwap(const char *, mark.start, mark.end); | 1709 | iSwap(const char *, mark.start, mark.end); |
1707 | } | 1710 | } |
1708 | if ((!*isInside && contains_Range(&run->text, mark.start)) || *isInside) { | 1711 | if ((!*isInside && (contains_Range(&run->text, mark.start) || mark.start == run->text.end)) || |
1712 | *isInside) { | ||
1709 | int x = 0; | 1713 | int x = 0; |
1710 | if (!*isInside) { | 1714 | if (!*isInside) { |
1711 | x = advanceRange_Text(run->font, (iRangecc){ run->text.start, mark.start }).x; | 1715 | x = advanceRange_Text(run->font, (iRangecc){ run->text.start, mark.start }).x; |