Skip to content

feat: Complete all URLs across all window types - #2255

Merged
jubalh merged 1 commit into
masterfrom
urls-autocomplete-all
Nov 12, 2026
Merged

jubalh merged 1 commit into
masterfrom
urls-autocomplete-all

Conversation

@jubalh

@jubalh jubalh commented Nov 12, 2026

Copy link
Copy Markdown
Member

URL autocompletion only indexed URLs from incoming messages sent by others.

Not our own outgoing messages. This as a conscious decision back then. Because I personally only wanted to to click on URLs sent by others.

In our MUC people repeatedly requested URL autocompletion to work for both. And eventually
#2212 was created.

Eventually onf started to work on supporting outgoing messages as well: #2214

Looking at it myself I decided we need to change things.

Each window maintained its own persistent Autocomplete instance (win->urls_ac).
On every incoming message stanza we scanned the message for URLs and updated the ac.

This meant:

  • Regex matching and heap allocations on every message, especially when getting MAM.
  • If someone used LMC (to update an URL) we didn't update the ac.
  • Unnecessary memory footprint per window.

Now URL autocompletion scans the window message buffer on demand. It works on each window type (also console and xml debug window). On ALL messages in the window: incoming messages, outgoing messages, MUC subject, etc.
And it works on LMC as well since we use the changed text.

The design is also better now:
We dont have urls_ac in the struct prof_win_t anymore but encapsulated it as a single module-level cache in window_list.c and removed allocation/free boilerplate across window creation/close functions.

So we have zero regex executions and zero allocations during message receipt. Which is awesome because some users don't even use the URL command and even if you do you do it not for each message.

If we received a 1000 message MAM replay on a room join we got 1000 regex executions, allocating strings, etc.
Now we have zero since we only scan for URLs on demand.

The first tab press on URL autocompletion now scans the window buffer (<= 200 entries). Subsequent tab cycling runs in O(1) time from the cache.

Earlier we built the regex upon each message. Now we only do it on demand AND we use a precompiled regex. So everything will be much faster.

Fixes: #2212
Ref: #2214
Ref: #225
Ref: #1946

URL autocompletion only indexed URLs from incoming messages sent by
others.

Not our own outgoing messages. This as a conscious decision back then.
Because I personally only wanted to to click on URLs sent by others.

In our MUC people repeatedly requested URL autocompletion to work for
both. And eventually
#2212 was created.

Eventually `onf` started to work on supporting outgoing messages as
well: #2214

Looking at it myself I decided we need to change things.

Each window maintained its own persistent Autocomplete instance
(win->urls_ac).
On every incoming message stanza we scanned the message for URLs and
updated the ac.

This meant:
* Regex matching and heap allocations on every message, especially when getting MAM.
* If someone used LMC (to update an URL) we didn't update the ac.
* Unnecessary memory footprint per window.

Now URL autocompletion scans the window message buffer on demand.
It works on each window type (also console and xml debug window).
On ALL messages in the window: incoming messages, outgoing
messages, MUC subject, etc.
And it works on LMC as well since we use the changed text.

The design is also better now:
We dont have urls_ac in the struct prof_win_t anymore but encapsulated it as a
single module-level cache in window_list.c and removed allocation/free
boilerplate across window creation/close functions.

So we have zero regex executions and zero allocations during message receipt.
Which is awesome because some users don't even use the URL command and
even if you do you do it not for each message.

If we received a 1000 message MAM replay on a room join we got 1000
regex executions, allocating strings, etc.
Now we have zero since we only scan for URLs on demand.

The first tab press on URL autocompletion now scans the window buffer (<= 200 entries).
Subsequent tab cycling runs in O(1) time from the cache.

Earlier we built the regex upon each message. Now we only do it on
demand AND we use a precompiled regex. So everything will be much
faster.

Fixes: #2212
Ref: #2214
Ref: #225
Ref: #1946
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
@jubalh

jubalh commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

@mdosch @shan995-cell JFYI

@jubalh
jubalh merged commit 85acfc3 into master Nov 12, 2026
12 checks passed
@jubalh
jubalh deleted the urls-autocomplete-all branch November 12, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opt-in setting to include own messages in /url autocompletion

1 participant