Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–120 unchanged (120 lines)
121 switch (typeOpt)
122 {
123 case DispatchTypes::GraphicsOptions::RGBColorOrFaint:
124 {
125 // sub params are in the order:
126 // :2:<color-space-id>:<r>:<g>:<b>
127
128 // We treat a color as invalid if it has a non-empty color space ID, as
129 // some applications that support non-standard ODA color sequence might
130 // send the red value in its place.
131 const bool hasColorSpaceId = options.at(1).has_value();
132
133 const size_t red = options.at(2).value_or(0);
134 const size_t green = options.at(3).value_or(0);
135 const size_t blue = options.at(4).value_or(0);
136
137 // We only apply the color if the R, G, B values fit within a byte.
138 // This is to match XTerm's and VTE's behavior.
139 if (!hasColorSpaceId && red <= 255 && green <= 255 && blue <= 255)
140 {
141 applyColor(TextColor{ RGB(red, green, blue) });
142 }
143 break;
144 }
145 case DispatchTypes::GraphicsOptions::BlinkOrXterm256Index:
…lines 146–481 unchanged (336 lines)

After

…lines 1–120 unchanged (120 lines)
121 switch (typeOpt)
122 {
123 case DispatchTypes::GraphicsOptions::RGBColorOrFaint:
124 {
125 // sub params are in the order:
126 // :2:<color-space-id>:<r>:<g>:<b>
127
128 // We treat a color as invalid if it has a non-zero color space ID, as
129 // some applications that support non-standard ODA color sequence might
130 // send the red value in its place.
131 const bool validColorSpace = options.at(1).value_or(0) == 0;
132
133 const size_t red = options.at(2).value_or(0);
134 const size_t green = options.at(3).value_or(0);
135 const size_t blue = options.at(4).value_or(0);
136
137 // We only apply the color if the R, G, B values fit within a byte.
138 // This is to match XTerm's and VTE's behavior.
139 if (validColorSpace && red <= 255 && green <= 255 && blue <= 255)
140 {
141 applyColor(TextColor{ RGB(red, green, blue) });
142 }
143 break;
144 }
145 case DispatchTypes::GraphicsOptions::BlinkOrXterm256Index:
…lines 146–481 unchanged (336 lines)

Before

translation_unit
comment "// Copyright (c) Microsoft Corporation.\r"
comment "// Licensed under the MIT license.\r"
preproc_include
#include "#include"
string_literal
" "\""
string_content "precomp.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "adaptDispatch.hpp"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "../../types/inc/utils.hpp"
" "\""
preproc_def
#define "#define"
identifier "ENABLE_INTSAFE_SIGNED_FUNCTIONS"
preproc_include
#include "#include"
system_lib_string "<intsafe.h>"
using_declaration
using "using"
namespace "namespace"
qualified_identifier
namespace_identifier "Microsoft"
:: "::"
qualified_identifier
namespace_identifier "Console"
:: "::"
identifier "VirtualTerminal"
; ";"
using_declaration
using "using"
namespace "namespace"
qualified_identifier
namespace_identifier "Microsoft"
:: "::"
qualified_identifier
namespace_identifier "Console"
:: "::"
qualified_identifier
namespace_identifier "VirtualTerminal"
:: "::"
identifier "DispatchTypes"
; ";"
comment "// Routine Description:\r"
comment "// - Helper to parse the underline style option.\r"
comment "// Arguments:\r"
comment "// - options - An option that will be used to interpret the "...
comment "// - attr - The attribute that will be updated with the pars"...
comment "// Return Value:\r"
comment "// - <none>\r"
function_definition (+102 nodes collapsed)
comment "// Routine Description:\r"
comment "// - Helper to parse extended graphics options, which start "...
comment "// These options are followed by either a 2 (RGB) or 5 ("...
comment "// RGB sequences then take 3 MORE params to designate t"...
comment "// Xterm index will use the param that follows to use a"...
comment "// Arguments:\r"
comment "// - options - An array of options that will be used to gene"...
comment "// - attr - The attribute that will be updated with the pars"...
comment "// - isForeground - Whether or not the parsed color is for t"...
comment "// Return Value:\r"
comment "// - The number of options consumed, not including the initi"...
function_definition (+345 nodes collapsed)
comment "// Routine Description:\r"
comment "// - Helper to parse extended graphics options, which start "...
comment "// - These options are followed by either a 2 (RGB) or 5 ("...
comment "// - RGB sequences then take 4 MORE options to designate"...
comment "// of the color.\r"
comment "// - Xterm index will use the option that follows to use"...
comment "// preset 256 color xterm color table.\r"
comment "// Arguments:\r"
comment "// - colorItem - One of the FG(38), BG(48), UL(58), indicati"...
comment "// - options - An array of options that will be used to gene"...
comment "// - attr - The attribute that will be updated with the pars"...
comment "// Return Value:\r"
comment "// - <none>\r"
function_definition
primitive_type "void"
function_declarator (+27 nodes collapsed)
compound_statement
{ "{"
declaration (+100 nodes collapsed)
declaration
type_qualifier
const "const"
qualified_identifier
namespace_identifier "DispatchTypes"
:: "::"
type_identifier "GraphicsOptions"
init_declarator
identifier "typeOpt"
= "="
call_expression
field_expression
identifier "options"
. "."
field_identifier "at"
argument_list
( "("
number_literal "0"
) ")"
; ";"
switch_statement
switch "switch"
condition_clause
( "("
identifier "typeOpt"
) ")"
compound_statement
{ "{"
case_statement
case "case"
qualified_identifier
namespace_identifier "DispatchTypes"
:: "::"
qualified_identifier
namespace_identifier "GraphicsOptions"
:: "::"
identifier "RGBColorOrFaint"
: ":"
compound_statement
{ "{"
comment "// sub params are in the order:\r"
comment "// :2:<color-space-id>:<r>:<g>:<b>\r"
comment "// We treat a color as invalid if it has a non-empty color s"...
comment "// some applications that support non-standard ODA color seq"...
comment "// send the red value in its place.\r"
declaration
type_qualifier
const "const"
primitive_type "bool"
init_declarator
identifier "hasColorSpaceId"
= "="
call_expression
field_expression
call_expression
field_expression
identifier "options"
. "."
field_identifier "at"
argument_list
( "("
number_literal "1"
) ")"
. "."
field_identifier "has_value"
argument_list
( "("
) ")"
; ";"
declaration (+25 nodes collapsed)
declaration (+25 nodes collapsed)
declaration (+25 nodes collapsed)
comment "// We only apply the color if the R, G, B values fit within "...
comment "// This is to match XTerm's and VTE's behavior.\r"
if_statement
if "if"
condition_clause
( "("
binary_expression
binary_expression
binary_expression
unary_expression
! "!"
identifier "hasColorSpaceId"
&& "&&"
binary_expression
identifier "red"
<= "<="
number_literal "255"
&& "&&"
binary_expression
identifier "green"
<= "<="
number_literal "255"
&& "&&"
binary_expression
identifier "blue"
<= "<="
number_literal "255"
) ")"
compound_statement (+25 nodes collapsed)
break_statement
break "break"
; ";"
} "}"
case_statement (+97 nodes collapsed)
case_statement
default "default"
: ":"
break_statement
break "break"
; ";"
} "}"
expression_statement
; ";"
} "}"
comment "// Routine Description:\r"
comment "// - Helper to apply a single graphic rendition option to an"...
comment "// - Calls appropriate helper to apply the option with sub p"...
comment "// Arguments:\r"
comment "// - options - An array of options.\r"
comment "// - optionIndex - The start index of the option that will b"...
comment "// - attr - The attribute that will be updated with the appl"...
comment "// Return Value:\r"
comment "// - The number of entries in the array that were consumed.\r"
function_definition (+1352 nodes collapsed)
comment "// Routine Description:\r"
comment "// - Helper to apply a single graphic rendition option with "...
comment "// Arguments:\r"
comment "// - option - An option to apply.\r"
comment "// - subParams - Sub parameters associated with the option.\r"
comment "// - attr - The attribute that will be updated with the appl"...
comment "// Return Value:\r"
comment "// - <None>\r"
function_definition (+103 nodes collapsed)
comment "// Routine Description:\r"
comment "// - Helper to apply a number of graphic rendition options t"...
comment "// Arguments:\r"
comment "// - options - An array of options that will be applied in s"...
comment "// - attr - The attribute that will be updated with the appl"...
comment "// Return Value:\r"
comment "// - <none>\r"
function_definition (+67 nodes collapsed)
comment "// Routine Description:\r"
comment "// - SGR - Modifies the graphical rendering options applied "...
comment "// characters written into the buffer.\r"
comment "// - Options include colors, invert, underlines, and o"...
comment "// type options.\r"
comment "// Arguments:\r"
comment "// - options - An array of options that will be applied from"...
comment "// one at a time by setting or removing flags in the font "...
function_definition (+71 nodes collapsed)
comment "// Routine Description:\r"
comment "// - DECSCA - Modifies the character protection attribute. T"...
comment "// originally intended to support a range of logical chara"...
comment "// but the protected attribute was the only one ever imple"...
comment "// Arguments:\r"
comment "// - options - An array of options that will be applied in o"...
function_definition (+170 nodes collapsed)
comment "// Method Description:\r"
comment "// - Saves the current text attributes to an internal stack."...
comment "// Arguments:\r"
comment "// - options: if not empty, specify which portions of the cu"...
comment "// be saved. Options that are not supported are ignored. I"...
comment "// all attributes are stored.\r"
function_definition (+57 nodes collapsed)
comment "// Method Description:\r"
comment "// - Restores text attributes from the internal stack. If on"...
comment "// were saved, combines those with the current attributes."...
comment "// Arguments:\r"
comment "// - <none>\r"
function_definition (+68 nodes collapsed)

After

translation_unit
comment "// Copyright (c) Microsoft Corporation.\r"
comment "// Licensed under the MIT license.\r"
preproc_include
#include "#include"
string_literal
" "\""
string_content "precomp.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "adaptDispatch.hpp"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "../../types/inc/utils.hpp"
" "\""
preproc_def
#define "#define"
identifier "ENABLE_INTSAFE_SIGNED_FUNCTIONS"
preproc_include
#include "#include"
system_lib_string "<intsafe.h>"
using_declaration
using "using"
namespace "namespace"
qualified_identifier
namespace_identifier "Microsoft"
:: "::"
qualified_identifier
namespace_identifier "Console"
:: "::"
identifier "VirtualTerminal"
; ";"
using_declaration
using "using"
namespace "namespace"
qualified_identifier
namespace_identifier "Microsoft"
:: "::"
qualified_identifier
namespace_identifier "Console"
:: "::"
qualified_identifier
namespace_identifier "VirtualTerminal"
:: "::"
identifier "DispatchTypes"
; ";"
comment "// Routine Description:\r"
comment "// - Helper to parse the underline style option.\r"
comment "// Arguments:\r"
comment "// - options - An option that will be used to interpret the "...
comment "// - attr - The attribute that will be updated with the pars"...
comment "// Return Value:\r"
comment "// - <none>\r"
function_definition (+102 nodes collapsed)
comment "// Routine Description:\r"
comment "// - Helper to parse extended graphics options, which start "...
comment "// These options are followed by either a 2 (RGB) or 5 ("...
comment "// RGB sequences then take 3 MORE params to designate t"...
comment "// Xterm index will use the param that follows to use a"...
comment "// Arguments:\r"
comment "// - options - An array of options that will be used to gene"...
comment "// - attr - The attribute that will be updated with the pars"...
comment "// - isForeground - Whether or not the parsed color is for t"...
comment "// Return Value:\r"
comment "// - The number of options consumed, not including the initi"...
function_definition (+345 nodes collapsed)
comment "// Routine Description:\r"
comment "// - Helper to parse extended graphics options, which start "...
comment "// - These options are followed by either a 2 (RGB) or 5 ("...
comment "// - RGB sequences then take 4 MORE options to designate"...
comment "// of the color.\r"
comment "// - Xterm index will use the option that follows to use"...
comment "// preset 256 color xterm color table.\r"
comment "// Arguments:\r"
comment "// - colorItem - One of the FG(38), BG(48), UL(58), indicati"...
comment "// - options - An array of options that will be used to gene"...
comment "// - attr - The attribute that will be updated with the pars"...
comment "// Return Value:\r"
comment "// - <none>\r"
function_definition
primitive_type "void"
function_declarator (+27 nodes collapsed)
compound_statement
{ "{"
declaration (+100 nodes collapsed)
declaration
type_qualifier
const "const"
qualified_identifier
namespace_identifier "DispatchTypes"
:: "::"
type_identifier "GraphicsOptions"
init_declarator
identifier "typeOpt"
= "="
call_expression
field_expression
identifier "options"
. "."
field_identifier "at"
argument_list
( "("
number_literal "0"
) ")"
; ";"
switch_statement
switch "switch"
condition_clause
( "("
identifier "typeOpt"
) ")"
compound_statement
{ "{"
case_statement
case "case"
qualified_identifier
namespace_identifier "DispatchTypes"
:: "::"
qualified_identifier
namespace_identifier "GraphicsOptions"
:: "::"
identifier "RGBColorOrFaint"
: ":"
compound_statement
{ "{"
comment "// sub params are in the order:\r"
comment "// :2:<color-space-id>:<r>:<g>:<b>\r"
comment "// We treat a color as invalid if it has a non-zero color sp"...
comment "// some applications that support non-standard ODA color seq"...
comment "// send the red value in its place.\r"
declaration
type_qualifier
const "const"
primitive_type "bool"
init_declarator
identifier "validColorSpace"
= "="
binary_expression
call_expression
field_expression
call_expression
field_expression
identifier "options"
. "."
field_identifier "at"
argument_list
( "("
number_literal "1"
) ")"
. "."
field_identifier "value_or"
argument_list
( "("
number_literal "0"
) ")"
== "=="
number_literal "0"
; ";"
declaration (+25 nodes collapsed)
declaration (+25 nodes collapsed)
declaration (+25 nodes collapsed)
comment "// We only apply the color if the R, G, B values fit within "...
comment "// This is to match XTerm's and VTE's behavior.\r"
if_statement
if "if"
condition_clause
( "("
binary_expression
binary_expression
binary_expression
identifier "validColorSpace"
&& "&&"
binary_expression
identifier "red"
<= "<="
number_literal "255"
&& "&&"
binary_expression
identifier "green"
<= "<="
number_literal "255"
&& "&&"
binary_expression
identifier "blue"
<= "<="
number_literal "255"
) ")"
compound_statement (+25 nodes collapsed)
break_statement
break "break"
; ";"
} "}"
case_statement (+97 nodes collapsed)
case_statement
default "default"
: ":"
break_statement
break "break"
; ";"
} "}"
expression_statement
; ";"
} "}"
comment "// Routine Description:\r"
comment "// - Helper to apply a single graphic rendition option to an"...
comment "// - Calls appropriate helper to apply the option with sub p"...
comment "// Arguments:\r"
comment "// - options - An array of options.\r"
comment "// - optionIndex - The start index of the option that will b"...
comment "// - attr - The attribute that will be updated with the appl"...
comment "// Return Value:\r"
comment "// - The number of entries in the array that were consumed.\r"
function_definition (+1352 nodes collapsed)
comment "// Routine Description:\r"
comment "// - Helper to apply a single graphic rendition option with "...
comment "// Arguments:\r"
comment "// - option - An option to apply.\r"
comment "// - subParams - Sub parameters associated with the option.\r"
comment "// - attr - The attribute that will be updated with the appl"...
comment "// Return Value:\r"
comment "// - <None>\r"
function_definition (+103 nodes collapsed)
comment "// Routine Description:\r"
comment "// - Helper to apply a number of graphic rendition options t"...
comment "// Arguments:\r"
comment "// - options - An array of options that will be applied in s"...
comment "// - attr - The attribute that will be updated with the appl"...
comment "// Return Value:\r"
comment "// - <none>\r"
function_definition (+67 nodes collapsed)
comment "// Routine Description:\r"
comment "// - SGR - Modifies the graphical rendering options applied "...
comment "// characters written into the buffer.\r"
comment "// - Options include colors, invert, underlines, and o"...
comment "// type options.\r"
comment "// Arguments:\r"
comment "// - options - An array of options that will be applied from"...
comment "// one at a time by setting or removing flags in the font "...
function_definition (+71 nodes collapsed)
comment "// Routine Description:\r"
comment "// - DECSCA - Modifies the character protection attribute. T"...
comment "// originally intended to support a range of logical chara"...
comment "// but the protected attribute was the only one ever imple"...
comment "// Arguments:\r"
comment "// - options - An array of options that will be applied in o"...
function_definition (+170 nodes collapsed)
comment "// Method Description:\r"
comment "// - Saves the current text attributes to an internal stack."...
comment "// Arguments:\r"
comment "// - options: if not empty, specify which portions of the cu"...
comment "// be saved. Options that are not supported are ignored. I"...
comment "// all attributes are stored.\r"
function_definition (+57 nodes collapsed)
comment "// Method Description:\r"
comment "// - Restores text attributes from the internal stack. If on"...
comment "// were saved, combines those with the current attributes."...
comment "// Arguments:\r"
comment "// - <none>\r"
function_definition (+68 nodes collapsed)