Handling of ; in control sequences
Submitted by Mariano Suárez-Alvarez
Link to original bug (#400072)
Description
Chris committed http://svn.gnome.org/viewcvs/vte/trunk/src/table.c?rev=1512&r1=1453&r2=1512:
2007-01-24 Chris Wilson chris@chris-wilson.co.uk
`<mariano>` hm, vte is not matching «ESC [ ; 7 m» :/
* src/table.c: (_vte_table_addi), (_vte_table_matchi),
(_vte_table_match):
s/GList/GSList/
g_slist_append -> g_slist_reverse(g_slist_prepend)
And finally add the subtable to handle the leading ';'
in the variable length parameters.
That patch makes vte ignore a leading ; for a %m parameter (in vte-parlance; that is, a sequence of numbers).
Actually, the parameter bytes sequence of a control sequence is to be separated in sub-sequences by ‘;’ charaters, and each sub-sequence that turns out to be empty after doing this (including the initial sub-sequence and the final one) represents a default value, depending on the control sequence. This is ECMA-48 5.4.2.
For example, «ESC [ ; 7 m» should be treated as «ESC [ 0 ; 7 m» because 0 is the default parameter for the «ESC [ Ps m» control sequence. Likewise «ESC [ m» stands for «ESC [ 0 m».
These control sequence variations do arise in practice: they are (part of) what is wrong with bug 398401.
As for the GList->SList optimization, I think that in practice control sequences with many parameters are extremely rare (one could get actual usage data here...), so that a simpler optimization would be to allocate a GPtrArray with, say, g_ptr_array_sized_new (10) and put there the arginfo thingies.
Resolution: RESOLVED FIXED