summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 882e029a..fd13cd72 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -272,12 +272,18 @@ void setUrl_DocumentWidget(iDocumentWidget *d, const iString *url) {
272 set_String(d->url, newUrl); 272 set_String(d->url, newUrl);
273 fetch_DocumentWidget_(d); 273 fetch_DocumentWidget_(d);
274 } 274 }
275 iRegExp *userPat = new_RegExp("~([^/?]+)", 0); 275 /* See if there a username in the URL. */ {
276 iRegExpMatch m; 276 clear_String(d->titleUser);
277 if (matchString_RegExp(userPat, d->url, &m)) { 277 iRegExp *userPats[2] = { new_RegExp("~([^/?]+)", 0),
278 setRange_String(d->titleUser, capturedRange_RegExpMatch(&m, 1)); 278 new_RegExp("/users/([^/?]+)", caseInsensitive_RegExpOption) };
279 iRegExpMatch m;
280 iForIndices(i, userPats) {
281 if (matchString_RegExp(userPats[i], d->url, &m)) {
282 setRange_String(d->titleUser, capturedRange_RegExpMatch(&m, 1));
283 }
284 iRelease(userPats[i]);
285 }
279 } 286 }
280 iRelease(userPat);
281 delete_String(newUrl); 287 delete_String(newUrl);
282} 288}
283 289
@@ -611,6 +617,16 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
611 } 617 }
612 } 618 }
613 } 619 }
620 if (ev->type == SDL_MOUSEBUTTONDOWN) {
621 if (ev->button.button == SDL_BUTTON_X1) {
622 postCommand_App("navigate.back");
623 return iTrue;
624 }
625 if (ev->button.button == SDL_BUTTON_X2) {
626 postCommand_App("navigate.forward");
627 return iTrue;
628 }
629 }
614 processContextMenuEvent_Widget(d->menu, ev); 630 processContextMenuEvent_Widget(d->menu, ev);
615 switch (processEvent_Click(&d->click, ev)) { 631 switch (processEvent_Click(&d->click, ev)) {
616 case started_ClickResult: 632 case started_ClickResult: