mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:57:44 +00:00
LibGfx+Userland: Make TextAttributes::underline_style optional
Rather than having a style AND a field saying whether to use the style, just make the style Optional.
This commit is contained in:
parent
609b616085
commit
6d8f046fd0
10 changed files with 16 additions and 19 deletions
|
@ -292,8 +292,8 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
|
|||
for (auto& span : document().spans()) {
|
||||
bool is_clickable = (highlighter->is_navigatable(span.data) || highlighter->is_identifier(span.data));
|
||||
if (span.range.contains(m_previous_text_position) && !span.range.contains(text_position)) {
|
||||
if (is_clickable && span.attributes.underline) {
|
||||
span.attributes.underline = false;
|
||||
if (is_clickable && span.attributes.underline_style.has_value()) {
|
||||
span.attributes.underline_style.clear();
|
||||
wrapper().editor().update();
|
||||
}
|
||||
}
|
||||
|
@ -304,9 +304,12 @@ void Editor::mousemove_event(GUI::MouseEvent& event)
|
|||
|
||||
if (is_clickable) {
|
||||
is_over_clickable = true;
|
||||
bool was_underlined = span.attributes.underline;
|
||||
span.attributes.underline = event.modifiers() & Mod_Ctrl;
|
||||
if (span.attributes.underline != was_underlined) {
|
||||
bool was_underlined = span.attributes.underline_style.has_value();
|
||||
bool now_underlined = event.modifiers() & Mod_Ctrl;
|
||||
span.attributes.underline_style.clear();
|
||||
if (now_underlined)
|
||||
span.attributes.underline_style = Gfx::TextAttributes::UnderlineStyle::Solid;
|
||||
if (now_underlined != was_underlined) {
|
||||
wrapper().editor().update();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue