This is, and I can't stress this enough, a lot better than all the
manual bounds checking and indexing that was going on before.
Also fixes a small bug where "\u{}" wouldn't get rejected as invalid
unicode escape sequence.
This allows going back one character at a time, and then re-consume
previously consumed chars.
The code I need this for looks something like this:
ASSERT(lexer.consume_specific('\\'));
if (lexer.next_is("foo"))
...
lexer.retreat();
lexer.consume_escaped_character(); // This expects lexer.peek() == '\\'
You can now do things like "kill -STOP pid" :^)
The getsignalbyname() helper function should probably move to LibC
or somewhere where it can be used by other signal related programs.
Some of the indexes generated during cursor movement were using column
instead of model_column(), which caused inconsistent display of items
under the cursor.
If an AbstractView receives focus without a valid cursor index, we now
ask it to move its cursor to the home position. This way, the user can
actually start moving the cursor after tabbing to a view.
We only use expect(...).toEval() / not.toEval() for checking syntax
errors, where we obviously can't put the code in a regular function. For
runtime errors we do exactly that, so toEval() should not fail - this
allows us to use undefined identifiers in syntax tests.
TreeView was still partly sticking to the pre-cursor way of using the
first index in the selection as the implied cursor. This patch fixes
all of the TreeView code to operate on the cursor instead.
This makes trees behave much more intuitively when alternating between
mouse and keyboard interaction.
Instead of filling the whole row with selection color, only fill behind
the text. This gives a snugger, more focused appearance.
For embedders that want the entire row to get filled with the selection
color when selected, they can opt in to the old behavior by calling
TreeView::set_should_fill_selected_rows(). This is used by Profiler.
Move the wrapping logic to get_item_rects(). This makes mouse events
able to hit the wrapped labels, and various other little things stop
glitching out as well.
Also, instead of having a per-line width when wrapping icon names,
make the text rect wide enough to fit every line.
This allows us to communicate details about invalid tokens to the parser
without having to invent a bunch of specific invalid tokens like
TokenType::InvalidNumericLiteral.
This fixes a bug where lines starting with a space would get parsed as
"level 0" headings - it would not find a "#" and therefore never
increase the level counter (starting at zero), which then would cause
the check for "space after #" pass (again, there is no "#").
Eventually we would get funny results like this:
<h0>[n-1 spaces]oops!</h0>
Also ASSERT(level > 0) in the Heading constructor.