Commit Graph

12396 Commits

Author SHA1 Message Date
Fabian Homborg
25a73a77bb Unset X-bit on tests
These files are not expected to be run directly.
2020-06-13 16:18:17 +02:00
Fabian Homborg
93c3aaf5f4 Port signals test to pexpect 2020-06-13 15:38:54 +02:00
Fabian Homborg
c11457f2db Port job_summary test to pexpect 2020-06-13 15:21:40 +02:00
Fabian Homborg
a6a1c6e775 Port read tests to expect
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.
2020-06-13 15:21:40 +02:00
Fabian Homborg
aafdaea2f9 Port wait test to pexpect 2020-06-13 15:21:40 +02:00
David Adam
68db32255a fish.spec: build depends on Python 3 on all platforms except RHEL 6 2020-06-12 23:54:29 +08:00
Fabian Homborg
d9b0a3b272 Revert "docs/tutorial: Fix duplicate sentence"
This reverts commit 9d1129f14c.

Probably a bad rebase, at the time this appeared on master the sentence was already removed.
2020-06-11 18:40:35 +02:00
David Adam
71f7a3abf4 fish.spec: override overzealous version format linting 2020-06-11 17:23:23 +08:00
Fabian Homborg
5cae62a266 docs: Document comments
Turns out they weren't.

Fixes #7106.
2020-06-10 17:39:04 +02:00
ridiculousfish
e91a06b764 Correct a misspeeling 2020-06-09 19:57:04 -07:00
ridiculousfish
269f907f2f Use inline ivar initialization in parse_node_t 2020-06-09 15:16:31 -07:00
ridiculousfish
19293ec2d6 Make parse_keyword_t an enum class 2020-06-09 15:13:02 -07:00
ridiculousfish
b4351c5927 Clean up posix_spawn code paths
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.
2020-06-09 14:59:06 -07:00
Lennard Hofmann
1b90be57f2 Add foot to update_cwd_osc
See https://codeberg.org/dnkl/foot
2020-06-09 12:49:33 -07:00
Fabian Homborg
15a789dda0 Fix fkr tests
I had fish_key_reader *installed*, so this worked for me.

But really we have the path in $fish_key_reader, so we want to use
that variable.
2020-06-08 23:19:57 +02:00
Fabian Homborg
f66edfdec2 Port generic.expect to pexpect
Removes a dumb workaround. Huzzah!
2020-06-08 22:57:46 +02:00
Fabian Homborg
339a5a2196 Port fkr expect to pexpect 2020-06-08 22:52:18 +02:00
Fabian Homborg
e094e770e8 docs: Some more work on fish_for_bash_users
[ci skip]
2020-06-08 20:44:56 +02:00
Fabian Homborg
cbefdb775d tests: Sleep for a bit
Gosh dangit Travis
2020-06-08 18:49:03 +02:00
Fabian Homborg
a4a4a2e1b6 __fish_print_packages: Fix apt
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.
2020-06-08 18:32:52 +02:00
Fabian Homborg
983f9eaa50 completions/apt: Let autoremove take packages
Fixes #7095

[ci skip]
2020-06-08 17:43:23 +02:00
Fabian Homborg
83808929a7 Remove pipestatus expect test
This doesn't really do more than the check of the same name.
2020-06-08 17:34:43 +02:00
Fabian Homborg
10fbdd34e7 Reformat pexpects
These are now python scripts
2020-06-08 17:33:04 +02:00
Fabian Homborg
3c6055c3e0 Move exit test to pexpect
This needs some subprocess magic, but otherwise it's nicely straightforward.
2020-06-08 17:31:18 +02:00
Fabian Homborg
9d523c7589 Move complete test to pexpect 2020-06-08 17:16:09 +02:00
Fabian Homborg
927aa60349 Move bind_mode_events test to pexpect 2020-06-08 17:12:49 +02:00
Fabian Homborg
7076880da9 Move commandline test to pexpect 2020-06-08 17:09:29 +02:00
Gokul
413a6aec98 Add completions for create_ap 2020-06-08 16:57:57 +02:00
ridiculousfish
9aa110314a Rationalize tty size and resizing
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.
2020-06-07 20:17:11 -07:00
ridiculousfish
c7160d7cb4 Eliminate the termsize handling from common.h
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.
2020-06-07 20:00:42 -07:00
ridiculousfish
6bdbe732e4 Adopt termsize_t in the pager 2020-06-07 20:00:42 -07:00
ridiculousfish
db909605b8 Migrate reformat_for_screen to new termsize container 2020-06-07 20:00:42 -07:00
ridiculousfish
340c8490f6 Introduce termsize_container_t
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.
2020-06-07 20:00:42 -07:00
ridiculousfish
d5a239e59e Bravely stop attempting to modify the terminal size
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.
2020-06-07 20:00:42 -07:00
ridiculousfish
df618a0768 Migrate DFLT_TERM from common.h to env.cpp
There's no reason every .cpp file needs to see these values.
2020-06-07 20:00:41 -07:00
ridiculousfish
7b486b4634 Factor s_reset better
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
2020-06-07 20:00:41 -07:00
ridiculousfish
fc42516dfb Unwind some calls to common_get_width from inside screen
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.
2020-06-07 20:00:41 -07:00
ridiculousfish
0673d86242 Remove a dead overload of s_reset
This function was not actually implemented.
2020-06-07 20:00:41 -07:00
ridiculousfish
812cc1dbaf Clean up line_t
Use a single allocation instead of two for text and colors.
Comment and tighten up its methods.
2020-06-07 20:00:41 -07:00
ridiculousfish
5429b54258 Remove k_invalid_termsize 2020-06-07 20:00:41 -07:00
ridiculousfish
462313f930 Remove ASSERT_IS_NOT_FORKED_CHILD from open_cloexec
This was tripping initialization order checks from ASAN, and is
otherwise not a very useful check here.
2020-06-07 19:58:52 -07:00
Kristofer Rye
3cfe113a60 builtin_string: Remove redundant condition in handle_flag_f
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>
2020-06-07 15:56:51 -07:00
ridiculousfish
8a27873598 Remove redundant expect tests
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.
2020-06-07 14:53:17 -07:00
ridiculousfish
4ae4314e63 Improve pexpect output
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.
2020-06-07 14:53:17 -07:00
ridiculousfish
3b7feb38e9 Add pexpect-based interactive testing framework
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.
2020-06-07 14:46:21 -07:00
ridiculousfish
218fe15264 Add 'pip install pexpect' to travis config
In preparation for the new pexpect-based tests, modify
the travis config file to install pexpect.
2020-06-07 14:41:05 -07:00
ridiculousfish
229ead9b8a env_stack_t::set_termsize to operate on self, not global stack 2020-06-07 12:57:34 -07:00
ridiculousfish
064324984b Use consistent variable names in decl and def of calc_prompt_layout 2020-06-07 12:56:14 -07:00
Rosen Penev
9636d9f5d3 [clang-tidy] remove pointless string init
Found with readability-redundant-string-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-07 12:49:35 -07:00
Rosen Penev
67e5473a11 [clang-tidy] remove pointless cstr
Found with readability-convert-member-functions-to-static

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-07 12:49:35 -07:00