diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gmutil.c | 6 | ||||
-rw-r--r-- | src/gmutil.h | 1 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 6 | ||||
-rw-r--r-- | src/ui/inputwidget.c | 6 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 4 |
5 files changed, 16 insertions, 7 deletions
diff --git a/src/gmutil.c b/src/gmutil.c index ab9a8eea..69fa6d9f 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -327,6 +327,12 @@ void urlEncodeSpaces_String(iString *d) { | |||
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | const iString *withSpacesEncoded_String(const iString *d) { | ||
331 | iString *enc = copy_String(d); | ||
332 | urlEncodeSpaces_String(enc); | ||
333 | return collect_String(enc); | ||
334 | } | ||
335 | |||
330 | const iString *feedEntryOpenCommand_String(const iString *url, int newTab) { | 336 | const iString *feedEntryOpenCommand_String(const iString *url, int newTab) { |
331 | if (!isEmpty_String(url)) { | 337 | if (!isEmpty_String(url)) { |
332 | iString *cmd = collectNew_String(); | 338 | iString *cmd = collectNew_String(); |
diff --git a/src/gmutil.h b/src/gmutil.h index 947ff56b..7227a072 100644 --- a/src/gmutil.h +++ b/src/gmutil.h | |||
@@ -110,5 +110,6 @@ void urlEncodePath_String (iString *); | |||
110 | iString * makeFileUrl_String (const iString *localFilePath); | 110 | iString * makeFileUrl_String (const iString *localFilePath); |
111 | const char * makeFileUrl_CStr (const char *localFilePath); | 111 | const char * makeFileUrl_CStr (const char *localFilePath); |
112 | void urlEncodeSpaces_String (iString *); | 112 | void urlEncodeSpaces_String (iString *); |
113 | const iString * withSpacesEncoded_String(const iString *); | ||
113 | 114 | ||
114 | const iString * feedEntryOpenCommand_String (const iString *url, int newTab); /* checks fragment */ | 115 | const iString * feedEntryOpenCommand_String (const iString *url, int newTab); /* checks fragment */ |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 8f2fc437..1ee83a85 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1653,11 +1653,11 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1653 | } | 1653 | } |
1654 | else if (equal_Command(cmd, "document.copylink") && document_App() == d) { | 1654 | else if (equal_Command(cmd, "document.copylink") && document_App() == d) { |
1655 | if (d->contextLink) { | 1655 | if (d->contextLink) { |
1656 | SDL_SetClipboardText(cstr_String( | 1656 | SDL_SetClipboardText(cstr_String(withSpacesEncoded_String(absoluteUrl_String( |
1657 | absoluteUrl_String(d->mod.url, linkUrl_GmDocument(d->doc, d->contextLink->linkId)))); | 1657 | d->mod.url, linkUrl_GmDocument(d->doc, d->contextLink->linkId))))); |
1658 | } | 1658 | } |
1659 | else { | 1659 | else { |
1660 | SDL_SetClipboardText(cstr_String(d->mod.url)); | 1660 | SDL_SetClipboardText(cstr_String(withSpacesEncoded_String(d->mod.url))); |
1661 | } | 1661 | } |
1662 | return iTrue; | 1662 | return iTrue; |
1663 | } | 1663 | } |
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index 85bd8b8b..6992bbec 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -514,8 +514,10 @@ static size_t coordIndex_InputWidget_(const iInputWidget *d, iInt2 coord) { | |||
514 | static iBool copy_InputWidget_(iInputWidget *d, iBool doCut) { | 514 | static iBool copy_InputWidget_(iInputWidget *d, iBool doCut) { |
515 | if (!isEmpty_Range(&d->mark)) { | 515 | if (!isEmpty_Range(&d->mark)) { |
516 | const iRanges m = mark_InputWidget_(d); | 516 | const iRanges m = mark_InputWidget_(d); |
517 | SDL_SetClipboardText(cstrCollect_String( | 517 | iString *str = collect_String(newUnicodeN_String(constAt_Array(&d->text, m.start), |
518 | newUnicodeN_String(constAt_Array(&d->text, m.start), size_Range(&m)))); | 518 | size_Range(&m))); |
519 | SDL_SetClipboardText( | ||
520 | cstr_String(d->inFlags & isUrl_InputWidgetFlag ? withSpacesEncoded_String(str) : str)); | ||
519 | if (doCut) { | 521 | if (doCut) { |
520 | pushUndo_InputWidget_(d); | 522 | pushUndo_InputWidget_(d); |
521 | deleteMarked_InputWidget_(d); | 523 | deleteMarked_InputWidget_(d); |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index cde95892..c31e157c 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -753,7 +753,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
753 | else if (isCommand_Widget(w, ev, "bookmark.copy")) { | 753 | else if (isCommand_Widget(w, ev, "bookmark.copy")) { |
754 | const iSidebarItem *item = d->contextItem; | 754 | const iSidebarItem *item = d->contextItem; |
755 | if (d->mode == bookmarks_SidebarMode && item) { | 755 | if (d->mode == bookmarks_SidebarMode && item) { |
756 | SDL_SetClipboardText(cstr_String(&item->url)); | 756 | SDL_SetClipboardText(cstr_String(withSpacesEncoded_String(&item->url))); |
757 | } | 757 | } |
758 | return iTrue; | 758 | return iTrue; |
759 | } | 759 | } |
@@ -974,7 +974,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
974 | else if (isCommand_Widget(w, ev, "history.copy")) { | 974 | else if (isCommand_Widget(w, ev, "history.copy")) { |
975 | const iSidebarItem *item = d->contextItem; | 975 | const iSidebarItem *item = d->contextItem; |
976 | if (item && !isEmpty_String(&item->url)) { | 976 | if (item && !isEmpty_String(&item->url)) { |
977 | SDL_SetClipboardText(cstr_String(&item->url)); | 977 | SDL_SetClipboardText(cstr_String(withSpacesEncoded_String(&item->url))); |
978 | } | 978 | } |
979 | return iTrue; | 979 | return iTrue; |
980 | } | 980 | } |