1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 02:13:56 +09:00

LibLine: Consider URL in actual_rendered_string_length

This allows to not count URLs' metadata for the visible length.
This commit is contained in:
Lucas CHOLLET 2022-11-08 11:47:49 +01:00 committed by Ali Mohammad Pur
parent 84fd011c49
commit 4a9218451d
Notes: sideshowbarker 2024-07-17 04:38:10 +09:00

View file

@ -1778,6 +1778,7 @@ enum VTState {
Bracket = 5,
BracketArgsSemi = 7,
Title = 9,
URL = 11,
};
static VTState actual_rendered_string_length_step(StringMetrics& metrics, size_t index, StringMetrics::LineMetrics& current_line, u32 c, u32 next_c, VTState state, Optional<Style::Mask> const& mask, Optional<size_t> const& maximum_line_width = {}, Optional<size_t&> last_return = {});
@ -1966,6 +1967,8 @@ VTState actual_rendered_string_length_step(StringMetrics& metrics, size_t index,
if (c == ']') {
if (next_c == '0')
state = Title;
if (next_c == '8')
state = URL;
return state;
}
if (c == '[') {
@ -1989,6 +1992,10 @@ VTState actual_rendered_string_length_step(StringMetrics& metrics, size_t index,
if (c == 7)
state = Free;
return state;
case URL:
if (c == '\\')
state = Free;
return state;
}
return state;
}