Repository navigation
feat: Complete all URLs across all window types - #2255
Merged
Merged
Conversation
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>
This was referenced Nov 12, 2026
Member
Author
|
@mdosch @shan995-cell JFYI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
onfstarted to work on supporting outgoing messages as well: #2214Looking 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:
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