=> 01b09cc3cf3cd25396c53e184563fbfdab74f8e7
[1mdiff --git a/src/app.c b/src/app.c[m [1mindex 84e57ce2..2928522b 100644[m [1m--- a/src/app.c[m [1m+++ b/src/app.c[m [36m@@ -912,11 +912,30 @@[m [miBool handleCommand_App(const char *cmd) {[m setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"),[m schemeProxy_App(range_CStr("gopher")));[m setCommandHandler_Widget(dlg, handlePrefsCommands_);[m [31m- postCommand_App("focus.set id:prefs.downloads");[m }[m else if (equal_Command(cmd, "navigate.home")) {[m [31m- /* TODO: Look for bookmarks tagged homepage, or use the URL set in Preferences. */[m [31m- postCommand_App("open url:about:lagrange");[m [32m+[m[32m /* Look for bookmarks tagged "homepage". */[m [32m+[m[32m iRegExp *pattern = iClob(new_RegExp("\\bhomepage\\b", caseInsensitive_RegExpOption));[m [32m+[m[32m const iPtrArray *homepages =[m [32m+[m[32m list_Bookmarks(d->bookmarks, NULL, filterTagsRegExp_Bookmarks, pattern);[m [32m+[m[32m if (isEmpty_PtrArray(homepages)) {[m [32m+[m[32m postCommand_App("open url:about:lagrange");[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m iStringSet *urls = iClob(new_StringSet());[m [32m+[m[32m iConstForEach(PtrArray, i, homepages) {[m [32m+[m[32m const iBookmark *bm = i.ptr;[m [32m+[m[32m /* Try to switch to a different bookmark. */[m [32m+[m[32m if (cmpStringCase_String(url_DocumentWidget(document_App()), &bm->url)) {[m [32m+[m[32m insert_StringSet(urls, &bm->url);[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m if (!isEmpty_StringSet(urls)) {[m [32m+[m[32m postCommandf_App([m [32m+[m[32m "open url:%s",[m [32m+[m[32m cstr_String(constAt_StringSet(urls, iRandoms(0, size_StringSet(urls)))));[m [32m+[m[32m }[m [32m+[m[32m }[m return iTrue;[m }[m else if (equal_Command(cmd, "zoom.set")) {[m [1mdiff --git a/src/bookmarks.c b/src/bookmarks.c[m [1mindex 8fe7d109..7e98fb27 100644[m [1m--- a/src/bookmarks.c[m [1m+++ b/src/bookmarks.c[m [36m@@ -26,6 +26,7 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m #include[m #include [m #include [m [32m+[m[32m#include [m [m void init_Bookmark(iBookmark *d) {[m init_String(&d->url);[m [36m@@ -166,6 +167,12 @@[m [miBookmark *get_Bookmarks(iBookmarks *d, uint32_t id) {[m return (iBookmark *) value_Hash(&d->bookmarks, id);[m }[m [m [32m+[m[32miBool filterTagsRegExp_Bookmarks(void *regExp, const iBookmark *bm) {[m [32m+[m[32m iRegExpMatch m;[m [32m+[m[32m init_RegExpMatch(&m);[m [32m+[m[32m return matchString_RegExp(regExp, &bm->tags, &m);[m [32m+[m[32m}[m [32m+[m const iPtrArray *list_Bookmarks(const iBookmarks *d, iBookmarksCompareFunc cmp,[m iBookmarksFilterFunc filter, void *context) {[m lock_Mutex(d->mtx);[m [1mdiff --git a/src/bookmarks.h b/src/bookmarks.h[m [1mindex aac83be1..4889e7b5 100644[m [1m--- a/src/bookmarks.h[m [1m+++ b/src/bookmarks.h[m [36m@@ -55,6 +55,8 @@[m [miBookmark *get_Bookmarks (iBookmarks *, uint32_t id);[m typedef iBool (*iBookmarksFilterFunc) (void *context, const iBookmark *);[m typedef int (*iBookmarksCompareFunc)(const iBookmark **, const iBookmark **);[m [m [32m+[m[32miBool filterTagsRegExp_Bookmarks (void *regExp, const iBookmark *);[m [32m+[m /**[m * Lists all or a subset of the bookmarks in a sorted array of Bookmark pointers.[m *[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).