@@ -507,7 +507,7 @@ void Screen<Cell>::writeTextEnd()
507507 return ;
508508
509509 if (vtTraceSequenceLog)
510- vtTraceSequenceLog ()(" text: \" {}\" " , _pendingCharTraceLog);
510+ vtTraceSequenceLog ()(" [{}] text: \" {}\" " , _name , _pendingCharTraceLog);
511511
512512 _pendingCharTraceLog.clear ();
513513#endif
@@ -1790,7 +1790,10 @@ template <typename Cell>
17901790CRISPY_REQUIRES (CellConcept<Cell>)
17911791void Screen<Cell>::setGraphicsRendition(GraphicsRendition rendition)
17921792{
1793- _terminal->setGraphicsRendition (rendition);
1793+ if (rendition == GraphicsRendition::Reset)
1794+ _cursor.graphicsRendition = {};
1795+ else
1796+ _cursor.graphicsRendition .flags = CellUtil::makeCellFlags (rendition, _cursor.graphicsRendition .flags );
17941797}
17951798
17961799template <typename Cell>
@@ -2546,50 +2549,6 @@ namespace impl
25462549 return ApplyResult::Invalid;
25472550 }
25482551
2549- optional<RGBColor> parseColor (string_view const & value)
2550- {
2551- try
2552- {
2553- // "rgb:RR/GG/BB"
2554- // 0123456789a
2555- if (value.size () == 12 && value.substr (0 , 4 ) == " rgb:" && value[6 ] == ' /' && value[9 ] == ' /' )
2556- {
2557- auto const r = crispy::to_integer<16 , uint8_t >(value.substr (4 , 2 ));
2558- auto const g = crispy::to_integer<16 , uint8_t >(value.substr (7 , 2 ));
2559- auto const b = crispy::to_integer<16 , uint8_t >(value.substr (10 , 2 ));
2560- return RGBColor { r.value (), g.value (), b.value () };
2561- }
2562-
2563- // "#RRGGBB"
2564- if (value.size () == 7 && value[0 ] == ' #' )
2565- {
2566- auto const r = crispy::to_integer<16 , uint8_t >(value.substr (1 , 2 ));
2567- auto const g = crispy::to_integer<16 , uint8_t >(value.substr (3 , 2 ));
2568- auto const b = crispy::to_integer<16 , uint8_t >(value.substr (5 , 2 ));
2569- return RGBColor { r.value (), g.value (), b.value () };
2570- }
2571-
2572- // "#RGB"
2573- if (value.size () == 4 && value[0 ] == ' #' )
2574- {
2575- auto const r = crispy::to_integer<16 , uint8_t >(value.substr (1 , 1 ));
2576- auto const g = crispy::to_integer<16 , uint8_t >(value.substr (2 , 1 ));
2577- auto const b = crispy::to_integer<16 , uint8_t >(value.substr (3 , 1 ));
2578- auto const rr = static_cast <uint8_t >(r.value () << 4 );
2579- auto const gg = static_cast <uint8_t >(g.value () << 4 );
2580- auto const bb = static_cast <uint8_t >(b.value () << 4 );
2581- return RGBColor { rr, gg, bb };
2582- }
2583-
2584- return std::nullopt ;
2585- }
2586- catch (...)
2587- {
2588- // that will be a formatting error in stoul() then.
2589- return std::nullopt ;
2590- }
2591- }
2592-
25932552 Color parseColor (Sequence const & seq, size_t * pi)
25942553 {
25952554 // We are at parameter index `i`.
@@ -2701,9 +2660,7 @@ namespace impl
27012660 return Color {};
27022661 }
27032662
2704- template <typename Target>
2705- CRISPY_REQUIRES ((CellConcept<Target> || std::is_same_v<Target, Terminal>) )
2706- ApplyResult applySGR (Target& target, Sequence const & seq, size_t parameterStart, size_t parameterEnd)
2663+ ApplyResult applySGR (auto & target, Sequence const & seq, size_t parameterStart, size_t parameterEnd)
27072664 {
27082665 if (parameterStart == parameterEnd)
27092666 {
@@ -2916,7 +2873,7 @@ namespace impl
29162873 auto const & value = seq.intermediateCharacters ();
29172874 if (value == " ?" )
29182875 screen.requestDynamicColor (name);
2919- else if (auto color = parseColor (value); color.has_value ())
2876+ else if (auto color = vtbackend:: parseColor (value); color.has_value ())
29202877 screen.setDynamicColor (name, color.value ());
29212878 else
29222879 return ApplyResult::Invalid;
@@ -2948,7 +2905,7 @@ namespace impl
29482905 queryColor ((uint8_t ) index);
29492906 index = -1 ;
29502907 }
2951- else if (auto const color = parseColor (value))
2908+ else if (auto const color = vtbackend:: parseColor (value))
29522909 {
29532910 setColor ((uint8_t ) index, color.value ());
29542911 index = -1 ;
@@ -3408,10 +3365,10 @@ void Screen<Cell>::processSequence(Sequence const& seq)
34083365 {
34093366 if (auto const * fd = seq.functionDefinition (_terminal->activeSequences ()))
34103367 {
3411- vtTraceSequenceLog ()(" Processing {:<14} {}" , fd->documentation .mnemonic , seq.text ());
3368+ vtTraceSequenceLog ()(" [{}] Processing {:<14} {}" , _name , fd->documentation .mnemonic , seq.text ());
34123369 }
34133370 else
3414- vtTraceSequenceLog ()(" Processing unknown sequence: {}" , seq.text ());
3371+ vtTraceSequenceLog ()(" [{}] Processing unknown sequence: {}" , _name , seq.text ());
34153372 }
34163373#endif
34173374
@@ -3750,7 +3707,7 @@ ApplyResult Screen<Cell>::apply(FunctionDefinition const& function, Sequence con
37503707 case SCOSC: saveCursor (); break ;
37513708 case SD: scrollDown (seq.param_or <LineCount>(0 , LineCount { 1 })); break ;
37523709 case SETMARK: setMark (); break ;
3753- case SGR: return impl::applySGR (*_terminal , seq, 0 , seq.parameterCount ());
3710+ case SGR: return impl::applySGR (*this , seq, 0 , seq.parameterCount ());
37543711 case SGRRESTORE: restoreGraphicsRendition (); return ApplyResult::Ok;
37553712 case SGRSAVE: saveGraphicsRendition (); return ApplyResult::Ok;
37563713 case SM: {
0 commit comments