summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-14 14:20:13 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-14 14:24:00 +0200
commitf81dcd10b9c09524a00b3b819679eca1d7ad6bf5 (patch)
treec315f7dd51908a9564e0081528d67cf11cb8a799 /src/ui
parentb18205c60ee2c4549cf521e02f0223aec46e90b5 (diff)
SidebarWidget: Handling feed entry URLs with spaces
The sidebar failed to realize that an entry was the current one and/or already read, because URL encoding is not consistently applied. This needs addressing soon — internally, all URLs should have a consistent format (fully encoded or decoded, NFC normalized).
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/sidebarwidget.c5
-rw-r--r--src/ui/window.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index dc1a60dc..679d8e6f 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -134,7 +134,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
134 d->menu = NULL; 134 d->menu = NULL;
135 switch (d->mode) { 135 switch (d->mode) {
136 case feeds_SidebarMode: { 136 case feeds_SidebarMode: {
137 const iString *docUrl = url_DocumentWidget(document_App()); 137 const iString *docUrl = withSpacesEncoded_String(url_DocumentWidget(document_App()));
138 /* TODO: internal URI normalization */
138 iTime now; 139 iTime now;
139 iDate on; 140 iDate on;
140 initCurrent_Time(&now); 141 initCurrent_Time(&now);
@@ -490,6 +491,7 @@ void init_SidebarWidget(iSidebarWidget *d, enum iSidebarSide side) {
490 d->list = new_ListWidget(); 491 d->list = new_ListWidget();
491 setPadding_Widget(as_Widget(d->list), 0, gap_UI, 0, gap_UI); 492 setPadding_Widget(as_Widget(d->list), 0, gap_UI, 0, gap_UI);
492 addChild_Widget(content, iClob(d->list)); 493 addChild_Widget(content, iClob(d->list));
494 d->contextItem = NULL;
493 d->blank = new_Widget(); 495 d->blank = new_Widget();
494 addChildFlags_Widget(content, iClob(d->blank), resizeChildren_WidgetFlag); 496 addChildFlags_Widget(content, iClob(d->blank), resizeChildren_WidgetFlag);
495 addChildFlags_Widget(vdiv, iClob(content), expand_WidgetFlag); 497 addChildFlags_Widget(vdiv, iClob(content), expand_WidgetFlag);
@@ -1037,6 +1039,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1037 } 1039 }
1038 if (d->menu && ev->type == SDL_MOUSEBUTTONDOWN) { 1040 if (d->menu && ev->type == SDL_MOUSEBUTTONDOWN) {
1039 if (ev->button.button == SDL_BUTTON_RIGHT) { 1041 if (ev->button.button == SDL_BUTTON_RIGHT) {
1042 d->contextItem = NULL;
1040 if (!isVisible_Widget(d->menu)) { 1043 if (!isVisible_Widget(d->menu)) {
1041 updateMouseHover_ListWidget(d->list); 1044 updateMouseHover_ListWidget(d->list);
1042 } 1045 }
diff --git a/src/ui/window.c b/src/ui/window.c
index 39e43340..998f5681 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -432,7 +432,7 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {
432 iInputWidget *url = findWidget_App("url"); 432 iInputWidget *url = findWidget_App("url");
433 const iString *urlStr = collect_String(suffix_Command(cmd, "url")); 433 const iString *urlStr = collect_String(suffix_Command(cmd, "url"));
434 trimCache_App(); 434 trimCache_App();
435 visitUrl_Visited(visited_App(), urlStr, 0); 435 visitUrl_Visited(visited_App(), withSpacesEncoded_String(urlStr), 0); /* TODO: internal URI normalization */
436 postCommand_App("visited.changed"); /* sidebar will update */ 436 postCommand_App("visited.changed"); /* sidebar will update */
437 setText_InputWidget(url, urlStr); 437 setText_InputWidget(url, urlStr);
438 checkLoadAnimation_Window_(get_Window()); 438 checkLoadAnimation_Window_(get_Window());
@@ -902,6 +902,7 @@ static SDL_Surface *loadAppIconSurface_(int resized) {
902 902
903void init_Window(iWindow *d, iRect rect) { 903void init_Window(iWindow *d, iRect rect) {
904 theWindow_ = d; 904 theWindow_ = d;
905 d->win = NULL;
905 iZap(d->cursors); 906 iZap(d->cursors);
906 d->place.initialPos = rect.pos; 907 d->place.initialPos = rect.pos;
907 d->place.normalRect = rect; 908 d->place.normalRect = rect;