Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix weblink to Database_backends wiki page #14034

Conversation

Desour
Copy link
Member

@Desour Desour commented Nov 25, 2023

clickable_chat_weblinks considers the . at the end as part of the URI, and opens http://wiki.minetest.net/Database_backends..
Note that using angle brackets (<link>) is sadly also not supported by clickable_chat_weblinks.

To do

This PR is a Ready for Review.

How to test

  • Enable clickable_chat_weblinks.
  • Open an old world, or migrate to old db backend.
  • Open chat, ctrl+click the link.

@Desour Desour added the Bugfix 🐛 PRs that fix a bug label Nov 25, 2023
`clickable_chat_weblinks` considers the `.` at the end as part of the URI, and
opens <http://wiki.minetest.net/Database_backends.>.
Note that using angle brackets (`<link>`) is sadly also not supported by
`clickable_chat_weblinks`.
@Desour Desour force-pushed the fix_depr_warning_link_Database_backends branch from 1df3c1b to 9ef7bbf Compare November 25, 2023 15:06
@SmallJoker
Copy link
Member

At least xfce4-terminal does ignore tailing full stops automatically. Might it be a better idea to adapt the Minetest feature in this regard as well? I have yet not seen an URL that would end with a full stop.

@Desour
Copy link
Member Author

Desour commented Nov 25, 2023

Same for gnome-terminal, and (checks http://wiki.minetest.net/Database_backends. ) github under firefox.

Improving clickable_chat_weblinks would definitely be better. But I don't want to do this myself right now. Meanwhile this workaround also works.

@SmallJoker
Copy link
Member

diff --git a/src/chat.cpp b/src/chat.cpp
index a704996fc..1a28a74c1 100644
--- a/src/chat.cpp
+++ b/src/chat.cpp
@@ -375,6 +375,10 @@ u32 ChatBuffer::formatChatLine(const ChatLine &line, u32 cols,
                                        ++frag_length;
                                        tempchar = linestring[in_pos+frag_length];
                                }
+                               if (linestring[in_pos+frag_length - 1] == L'.') {
+                                       // Tailing full stop
+                                       frag_length--;
+                               }
 
                                space_pos = frag_length - 1;
                                // This frag may need to be force-split. That's ok, urls aren't "words"

@sfan5
Copy link
Collaborator

sfan5 commented Nov 26, 2023

Note that using angle brackets (<link>) is sadly also not supported by clickable_chat_weblinks.

IMO that should be fixed then. It's our own code.

@sfan5 sfan5 added the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Mar 20, 2024
@Zughy Zughy closed this Jun 1, 2024
@Zughy Zughy added the Adoption needed The pull request needs someone to adopt it. Adoption welcomed! label Jun 1, 2024
@appgurueu
Copy link
Contributor

@SmallJoker so what about your proposed patch? Why not push it (or open a PR if you feel it's nontrivial and there's something left to discuss)?

@SmallJoker
Copy link
Member

08485f6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Action / change needed Code still needs changes (PR) / more information requested (Issues) Adoption needed The pull request needs someone to adopt it. Adoption welcomed! Bugfix 🐛 PRs that fix a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants