mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-08 02:31:18 -03:00
Better error messages for EDITOR=vim git... type commands.
https://github.com/fish-shell/fish-shell/issues/809
This commit is contained in:
@@ -641,6 +641,31 @@ void tok_next(tokenizer_t *tok)
|
||||
|
||||
}
|
||||
|
||||
enum token_type tok_peek_next(tokenizer_t *tok, wcstring *out_next_string)
|
||||
{
|
||||
if (out_next_string != NULL)
|
||||
{
|
||||
out_next_string->clear();
|
||||
}
|
||||
|
||||
enum token_type result = TOK_END;
|
||||
if (tok_has_next(tok))
|
||||
{
|
||||
int saved = tok_get_pos(tok);
|
||||
tok_next(tok);
|
||||
result = tok_last_type(tok);
|
||||
|
||||
if (out_next_string != NULL)
|
||||
{
|
||||
const wchar_t *last = tok_last(tok);
|
||||
out_next_string->assign(last ? last : L"");
|
||||
}
|
||||
|
||||
tok_set_pos(tok, saved);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const wchar_t *tok_string(tokenizer_t *tok)
|
||||
{
|
||||
return tok?tok->orig_buff:0;
|
||||
|
||||
Reference in New Issue
Block a user