Skip to content

Commit

Permalink
default missing values to -1 instead of 0 as a 'magic value'
Browse files Browse the repository at this point in the history
  • Loading branch information
lolbrish committed Nov 2, 2011
1 parent 97159b2 commit 167ed4f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/VT100.rl
Expand Up @@ -22,6 +22,10 @@ static void printAllNumbers(std::vector<int>& numbers)
machine terminal;
write data;

ESC = 0x1B;
CSI = ESC '[';
OSC = ESC ']';

# Standard Escape Sequence Parameters.
# The following are equivalent:
# 1. ESC [ ; 4 ; 5 m
Expand All @@ -32,13 +36,15 @@ static void printAllNumbers(std::vector<int>& numbers)

# clear the stack at the beginning of a new escape sequence that takes
# parameters
action clearStack { this->numberStack.clear(); }
action clearStack {
this->numberStack.clear();
}

# if the escape sequence that takes paramters lacks a parameter, give it
# a parameter of zero which is generally a reset op.
action addNullOpAsNeeded {
action addNullOpAsNeeded {
if(this->numberStack.size() == 0) {
this->numberStack.push_back(0);
this->numberStack.push_back(-1);
}
}

Expand All @@ -51,6 +57,10 @@ static void printAllNumbers(std::vector<int>& numbers)

# Standard Escape Sequences


# CPR - Cursor Position Report - CSI [ Pline ; Pcolumn R
# default value 1

action resetMode { printf(" <-- resetMode"); printAllNumbers(this->numberStack); printf("\n"); }

action setTitle { printAction("setTitle"); }
Expand Down Expand Up @@ -118,9 +128,6 @@ static void printAllNumbers(std::vector<int>& numbers)
fhold; fgoto main;
}

ESC = 0x1B;
CSI = ESC '[';
OSC = ESC ']';

characterMode = CSI multiple_numeric_parameters 'm' @characterMode;
resetMode = CSI multiple_numeric_parameters 'l' @resetMode;
Expand Down

0 comments on commit 167ed4f

Please sign in to comment.