aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-07-17 08:40:20 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-07-17 08:40:20 +0000
commitcc290fa9b0c36e90f6af978f839c083d05f22a95 (patch)
tree91460c764c681fae1d12200b42cb563e0213c362
parentchangelog: add new 'unreleased' section (diff)
url-mode: assign label keys in reverse order
The _last_ URL is often the one you are interested in, and with this change, it is always assigned the first (and thus the same) key. Closes #2140
-rw-r--r--CHANGELOG.md8
-rw-r--r--url-mode.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6121955f..df52e27d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -67,6 +67,14 @@
## Unreleased
### Added
### Changed
+
+* URL labels are now assigned in reverse order, from bottom to
+ top. This ensures the **last** URL (which is often the one you are
+ interested in) is always assigned the same key ([#2140][2140]).
+
+[2140]: https://codeberg.org/dnkl/foot/issues/2140
+
+
### Deprecated
### Removed
### Fixed
diff --git a/url-mode.c b/url-mode.c
index 35843219..c25396cd 100644
--- a/url-mode.c
+++ b/url-mode.c
@@ -634,12 +634,12 @@ urls_assign_key_combos(const struct config *conf, url_list_t *urls)
size_t combo_idx = 0;
- tll_foreach(*urls, it) {
+ tll_rforeach(*urls, it) {
bool id_already_seen = false;
/* Look for already processed URLs where both the URI and the
* ID matches */
- tll_foreach(*urls, it2) {
+ tll_rforeach(*urls, it2) {
if (&it->item == &it2->item)
break;
@@ -659,7 +659,7 @@ urls_assign_key_combos(const struct config *conf, url_list_t *urls)
* them; if so, reuse the *same* key combo.
*/
bool url_already_seen = false;
- tll_foreach(*urls, it2) {
+ tll_rforeach(*urls, it2) {
if (&it->item == &it2->item)
break;
@@ -679,7 +679,7 @@ urls_assign_key_combos(const struct config *conf, url_list_t *urls)
free(combos[i]);
#if defined(_DEBUG) && LOG_ENABLE_DBG
- tll_foreach(*urls, it) {
+ tll_rforeach(*urls, it) {
if (it->item.key == NULL)
continue;