Skip to content

Commit

Permalink
Update ControlSequenceLength to handle colon VT param separators
Browse files Browse the repository at this point in the history
The ControlSequenceLength function calculates the length of a VT control
sequence--used by LengthInBufferCells. SGR control sequences might have
parameters, separated by semicolons... or possibly colons. See:

microsoft/terminal#4321

This change updates ControlSequenceLength to treat colons similarly to
semicolons.
  • Loading branch information
jazzdelightsme committed Mar 4, 2021
1 parent 9aede05 commit 0557031
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,7 @@ internal static void SetConsoleTextAttribute(ConsoleHandle consoleHandle, WORD a
// CSI params? '#' [{}pq] // XTPUSHSGR ('{'), XTPOPSGR ('}'), or their aliases ('p' and 'q')
//
// Where:
// params: digit+ (';' params)?
// params: digit+ ((';' | ':') params)?
// CSI: C0_CSI | C1_CSI
// C0_CSI: \x001b '[' // ESC '['
// C1_CSI: \x009b
Expand Down Expand Up @@ -2699,7 +2699,7 @@ internal static int ControlSequenceLength(string str, ref int offset)
{
c = str[offset++];
}
while ((offset < str.Length) && (char.IsDigit(c) || c == ';'));
while ((offset < str.Length) && (char.IsDigit(c) || (c == ';') || (c == ':')));

// Finally, handle the command characters for the specific sequences we
// handle:
Expand Down

0 comments on commit 0557031

Please sign in to comment.