- set_title (lex_rest_of_line (lexer), type);
- lex_discard_line (lexer);
+ /* Count the tokens in the title. */
+ size_t n = 0;
+ while (lex_next (lexer, n)->type != T_ENDCMD)
+ n++;
+
+ /* Get the raw representation of all the tokens, including any space
+ between them, and use it as the title. */
+ char *title = lex_next_representation (lexer, 0, n - 1);
+ set_title (title);
+ free (title);
+
+ /* Skip past the tokens. */
+ for (size_t i = 0; i < n; i++)
+ lex_get (lexer);