The block stack is now sound, and no longer needs this ancient
cleanup logic, which tried to account for cases where blocks
were pushed but never popped.
Currently the block stack is just a vector of pointers.
Clients must manually use new() to allocate a block, and then
transfer ownership to the stack (so must NOT delete it).
Give the parser itself responsibility for allocating blocks too,
so that it takes over both allocation and deletion. Use unique_ptr
to make deletion less error-prone.
Previously we would try to walk all the blocks (from within the
signal handler!) and mark them as skipped. Stop doing that, it's
wildly unsafe.
Also rationalize how the skip flag is set per block. Remove places
that shouldn't set it (e.g. break and continue shouldn't set skip
on the loop block).
read_in_chunks does not clear the intermediate string 'str'
between iterations, so every chunk has every other chunk prepended
to it.
A secondary issue is that it calls str2wcstring() on an intermediate
chunk, which may split multi-byte sequences. This needs to be deferred
to the end.
Test added. Fixes#3756
This implements a way to use the `functions` command to perform
introspection to learn about the characteristics of a function. Such as
where it came from.
Fixes#3295
If the kernel reports a size of zero for the rows or columns (i.e., what
`stty -a` reports) fall back to the `COLUMNS` and `LINES` variables. If
the resulting values are not reasonable fallback to using 80x24.
Fixes#3740
Refactor `builtin_read()` to split the code that does the actual reading
into separate functions. This introduces the `read_in_chunks()` function
but in this change it is just a clone of `read_one_char_at_a_time()`. It
will be modified to actually read in chunks in the next change.
Partial fix for #2007
The shell was doing a log of signal blocking/unblocking that hurts
performance and can be avoided. This reduced the elapsed time for a
simple benchmark by 25%.
Partial fix for #2007
We should never use stdio functions that use stdout implicitly. Saving a
few characters isn't worth the inconsistency. Too, using the forms such
as `fwprintf()` which take an explicit stream makes it easier to find
the places we write to stdout versus stderr.
Fixes#3728
* Added new function for the default prompt mode
Now fish mode prompt will call fish_default_mode_prompt, this will solve #3641
* Added function description
* Change wording for documentation about default mode prompt
* Finish changes requested in code review