Note: This includes a super cheesy thing to print variable contents.
The expect version has one that's a bit more elaborate (featuring a
marker setup), but tbh that doesn't seem to be worth it.
If we do need it, we can add it, but it seems more likely we'd just do
`set -S`, or do it in a check instead.
Prior to this change, the posix_spawn code paths used a fair amount of
manual management around its allocated structures (attrs and file actions).
Encapsulate this into a new class that manages memory management and error
handling.
On my system this printed just "Description:" without any additional
characters, so this awkward `sed` didn't match and produced *all
packages on one line*.
Tbh this should probably be rewritten, but first we'd have to find a
way to get proper output here.
This merges a collection of changes attempting to rationalize how fish
handles the tty size.
The basic problem this addresses is that, prior to this fix, a call to
`common_get_width()` could result in arbitary code execution, as it lazily
updates COLUMNS and LINES which fires events, etc. With the new design, we
explicitly track the 'last known' tty size and also whether it is known stale,
and update it only at defined points.
This stuff is fraught and tricky, and so it is a merge commit so that if
something breaks, we can revert the whole thing and not end up with two
sources of termsize truth. Knock on wood.
Finish the transition to termsize.h. Remove the scary termsize bits
from common.cpp, which can throw off events at arbitrary calls and are
dangerously reentrant. Migrate everyone to the new termsize.h.
fish's handling of terminal sizes is currently rather twisted. The
essential problem is that the terminal size may change at any point from a
SIGWINCH, and common_get_{width,height} may modify it and post variable
change events from arbitrary locations.
Tighten up the semantics. Assign responsibility for managing the tty size
to a new class, `termsize_container_t`. Rationalize locking and reentrancy.
Explicitly nail down the relationship between $COLUMNS/$LINES and the tty
size. The new semantics are: whatever changed most recently takes
precendence.
Prior to this fix, fish would attempt to resize the terminal via
TIOCSWINSZ, which was added as part of #3740. In practice this probably
never did anything useful since generally only the tty master can use
this. Remove the support and note it in the changelog.
Prior to this fix, s_reset would attempt to reset the screen, optionally
using the PROMPT_SP hack to go to the next line. This in turn required
passing in the screen width even if it wasn't needed (because we were
not going to abandon the line). Factor this into two functions:
- s_reset_line which does not apply the hack
- s_reset_abandoning_line which applies the PROMPT_SP hack
common_get_width will "lazily" decide the screen width, which means
changing the environment variable stack. This is a surprising thing
to do from the middle of screen rendering.
Switch to passing in widths explicitly to screen.
The removed comparison ({begin,end,field} == INT_MIN) always evaluates
to false, because at this point in evaluation, `begin <= 0` has already
been evaluated to be false. Since INT_MIN <= 0, the second conditional
in all three of the affected cases is always false. The C++ standard
seems to guarantee left-to-right evaluation of logical operators, but
not necessarily bitwise operators.
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
With the new pexpect based framework, bind and pipeline expect tests can
be removed.
Amusingly the complete.fish check required the existence of bind.expect.
Fix the check at the same time.
Make it easier to use pexpect and to understand its error messages.
Switch to a style in tests using bound methods, which makes them
less noisy to write.
This adds a new interactive test framework based on Python's pexpect. This
is intended to supplant the TCL expect-based tests.
New tests go in `tests/pexpects/`. As a proof-of-concept, the
pipeline.expect test and the (gnarly) bind.expect test are ported to the
new framework.