1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Make chat web links clickable (#11092)

If enabled in minetest.conf, provides colored, clickable (middle-mouse or ctrl-left-mouse) weblinks in chat output, to open the OS' default web browser.
This commit is contained in:
pecksin 2021-06-20 11:20:24 -04:00 committed by GitHub
parent e1b297a14b
commit 1805775f3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 242 additions and 30 deletions

View file

@ -57,6 +57,8 @@ struct ChatFormattedFragment
EnrichedString text;
// starting column
u32 column;
// web link is empty for most frags
std::string weblink;
// formatting
//u8 bold:1;
};
@ -118,6 +120,7 @@ public:
std::vector<ChatFormattedLine>& destination) const;
void resize(u32 scrollback);
protected:
s32 getTopScrollPos() const;
s32 getBottomScrollPos() const;
@ -138,6 +141,11 @@ private:
std::vector<ChatFormattedLine> m_formatted;
// Empty formatted line, for error returns
ChatFormattedLine m_empty_formatted_line;
// Enable clickable chat weblinks
bool m_cache_clickable_chat_weblinks;
// Color of clickable chat weblinks
irr::video::SColor m_cache_chat_weblink_color;
};
class ChatPrompt