Commit Graph

219 Commits

Author SHA1 Message Date
Sanne Wouda
32936b0eb9 Change lookahead_list into a queue
Using builtin `commandline -f`, one would expect to have commands executed in
the order that they were given.  This motivates the change to a queue.

Unfortunately, fish internals still need lookahead_list to act as a stack.  Add
and rename functions to support both cases and have lookahead_list as
a std::deque internally.

This code is delicate, and we should probably dog-food this in nightly for
a while before the next-minor release.

Fixes #1567
2015-04-19 16:56:48 -07:00
Sanne Wouda
cb1e3c501d Simplify begin_header production
The TOK_END is swallowed by the subsequent job_list anyway.
2015-04-13 13:23:59 +08:00
Sanne Wouda
9e8e5af064 Add test cases for parsing 'begin' without ';' 2015-04-13 13:23:59 +08:00
Martin Hamrle
94e9d6a5ef Add paging into navigating pager 2015-03-20 14:41:38 +08:00
ridiculousfish
68efa5233c Fix and add tests for format_long_safe with negative numbers 2015-01-18 16:03:21 -08:00
ridiculousfish
20974edc14 Use iothread_perform variant that doesn't take a completion callback
Removes some ugly NULL casts
2015-01-14 10:05:07 -08:00
ridiculousfish
7864d0d416 Rework file descriptor handling
Remove global array of file descriptors, in
favor of relying on CLO_EXEC exclusively.
Also correctly implement "pipe avoidance" so
that fd redirections do not conflict
with pipes.
2015-01-07 18:07:06 -08:00
ridiculousfish
eafd577629 Hack the tokenizer to compress multiple adjacent newlines into one
This slightly reduces the size of parse trees, and is otherwise a
minor optimization
2014-11-24 01:23:42 -08:00
ridiculousfish
c31ad3ed07 Disallow backgrounding in conditionals and before and/or bool statements
Fixes #1136
2014-11-02 13:11:27 -08:00
ridiculousfish
fbade198b9 Support space separators for abbreviations as part of #731 2014-10-11 16:50:16 -07:00
ridiculousfish
c181de1d7f Teach the highlighter about multiple adjacent square bracket expansions
Fixes #1627
2014-09-30 11:15:22 -07:00
ridiculousfish
27dd37ebb4 Fix to indent comments in blocks properly (#1710)
This makes two changes to parse trees:

1. Unmaterialized nodes no longer have an invalid source location
For example, with the code `while false;end` there are no tokens
associated with the while loop's job_list, and therefore it is
unmaterialized. Previously it would have had a SOURCE_OFFSET_INVALID.
But now it has a zero source length, but an offset equal to the end of
the while loop (i.e. the semicolon), and a zero length. Correspondingly,
the has_source function now checks the length instead of the offset.

2. Special (comment and error) nodes have always been "disconnected,"
meaning they are not the child of any other node. However, they now have
their parent offsets set to whatever the top of the node stack was when
the node was encountered. This gives us a sense of which node the
comment is "in", e.g. if we are constructing a job list then the
comment's parent will be the job list. This lets us determine the
comment's indent.
2014-09-29 11:30:21 -07:00
ridiculousfish
b511550917 Revert "Prepend ./ to "flag-like file" wildcard expansions and completions"
This reverts commit 316d7004a3.

Reverts fix for 1519 in light of #1713

Conflicts:
	fish_tests.cpp
2014-09-25 22:18:36 -07:00
Kevin Ballard
7935b86cb2 Report expand errors better in fish tests
Print the expected and actual results if an error occurs.
2014-09-25 19:45:54 -07:00
Kevin Ballard
fb8eb22e56 Refactor expand tests slightly to handle errors better
If we get an error relating to our manipulation of the temporary
directory or cwd, we don't want to run the rest of the tests that assume
it worked.
2014-09-25 18:51:03 -07:00
ridiculousfish
316d7004a3 Prepend ./ to "flag-like file" wildcard expansions and completions
If a wildcard or completion expands to a file that begins with
one or more dashes, prepend a ./ to it so that it doesn't get
parsed as an option.

Fixes #1519
2014-09-24 22:06:43 -07:00
ridiculousfish
7d7a636f24 Allow running executables with $ in their name.
Fixes #1686
2014-09-21 23:35:19 -07:00
Kevin Ballard
8f8c4cdd17 Implement new read --null flag
The `--null` flag to `read` makes it split incoming lines on NUL instead
of newlines. This is intended for processing the output of a command
that uses NUL separators (such as `find -print0`).

Fixes #1694.
2014-09-21 19:27:26 -07:00
ridiculousfish
9419191aa6 Clean up variable expansion, and properly handle embedded NULs 2014-08-24 14:39:56 -07:00
ridiculousfish
d8b955294a Add a test for syntax highlighting pipes 2014-08-22 11:53:20 -07:00
ridiculousfish
06400b83b1 Support for command wrapping ("aliases")
Add the --wraps option to 'complete' and 'function'. This allows a
command to (recursively) inherit the completions of a wrapped command.
Fixes #393.

When evaluating a completion, we inspect the entire "wrap chain" for a
command, i.e. we follow the sequence of wrapping until we either hit a
loop (which we silently ignore) or the end of the chain. We then
evaluate completions as if the wrapping command were substituted with
the wrapped command. Currently this only works for commands, i.e.
'complete --command gco --wraps git\ checkout' won't work (that would
seem to encroaching on abbreviations anyways). It might be useful to
show an error message for that case.

The commandline builtin reflects the commandline with the wrapped
command substituted in, so e.g. git completions (which inspect the
command line) will just work. This sort of command line munging is
also performed by 'complete -C' so it's not totally without precedent.

'alias will also now mark its generated function as wrapping the
'target.
2014-08-15 18:14:36 -07:00
ridiculousfish
cb480dddf6 Don't try to colorize errors when running in Xcode 2014-08-04 13:55:53 -07:00
ridiculousfish
33c714ca03 Add fish_tests target to Xcode build
Allows running the tests in Xcode
2014-08-04 13:32:23 -07:00
ridiculousfish
35ba97cbdf Fix up OSC / iTerm2 escape code parsing as part of #1565 2014-07-30 11:35:39 -07:00
George Nachman
9f59cf1468 Parse OSC codes in escape_code_length(). They begin with <esc> ] and are terminated with ST (<esc> backslash) or BEL (ASCII 7). 2014-07-30 11:35:39 -07:00
ridiculousfish
52ae5f885e Improve history robustness against corrupt files
Fixes #1581
2014-07-29 14:42:03 -07:00
ridiculousfish
d07ea3b66a Teach fish to compute the length of more escape sequences.
Fixes #1243
2014-07-26 14:07:17 -07:00
ridiculousfish
e9f870e25a Add support for history --merge to incorporate history changes from
other sessions.

Fixes #825
2014-07-25 10:49:12 -07:00
ridiculousfish
3513ce3ac0 Universal variable callbacks should only be announced for changed
values, not every value. Also support erase notifications.
2014-06-16 12:27:28 -07:00
ridiculousfish
6277a2e4a4 Migrate global functions out of env_universal. Have env operate directly
on an env_universal_t.
2014-06-15 17:30:50 -07:00
ridiculousfish
9ae06c541f Remove inotify-based universal notifier
The inotify notifier is fragile, fails on travis, and fails to compile
on certain Linux kernels. It doesn't appear to work as well as the named
pipe mechanism. Best to just get rid of it.
2014-05-29 09:57:56 -07:00
ridiculousfish
8769c06350 Fix some annoying warnings in fish_tests with gcc 4.8 2014-05-24 16:15:45 -07:00
ridiculousfish
8a577a9d4d Remove an errant system("ls") 2014-05-21 10:55:00 -07:00
ridiculousfish
950150469a Disable inotify tests pending investigation into why it fails on
travis-ci
2014-05-21 10:50:57 -07:00
ridiculousfish
e214df8980 Try using IN_DELETE_SELF with inotify 2014-05-16 13:37:23 +08:00
ridiculousfish
e3cccdf571 Add check for kernel version to try to determine why travis-ci is
failing with inotify
2014-05-16 13:09:10 +08:00
ridiculousfish
a0bf841be2 Check for non-negative watch object in inotify_add_watch 2014-05-16 12:54:52 +08:00
ridiculousfish
73cbb0c65f Add a check to ensure the file really is deleted in inotify test 2014-05-16 12:35:07 +08:00
ridiculousfish
2f89ddbead Add test for inotify support to try to track down travis-ci is failing 2014-05-16 12:16:10 +08:00
ridiculousfish
a526693915 Refine test for enabling strategy_inotify in fish_tests 2014-05-15 17:25:13 +08:00
ridiculousfish
31f2a3a7d7 Fix a warning about missing enum in fish_tests.cpp 2014-05-15 14:44:17 +08:00
ridiculousfish
d554b7da08 Merge branch 'master' into death_of_fishd 2014-05-09 16:07:11 -07:00
ridiculousfish
e97bec10ea Remove needs_polling from universal_notifier_t. Add some expository
comments.
2014-05-07 14:22:05 -07:00
ridiculousfish
7763718b60 Further cleanup and rationalization of named pipe universal notifier. 2014-05-06 14:10:55 -07:00
Konrad Borowski
7f2c4cbf8a Move the empty function test to tests. 2014-05-06 12:31:44 +02:00
ridiculousfish
8a263952ad Fix named pipe universal notifier. No more threads. Tests now pass. 2014-05-05 23:33:05 -07:00
Konrad Borowski
16534ec644 Improve test_wchar2utf8().
Currently it contains strange code like using `do` loop in order to
avoid `goto`s (they aren't evil, honestly), the pointless `if (mem)`
conditional which doesn't even work (had semicolon for some reason).

You may think this code had a bug where the code didn't check for
the pointer to be null before calling `free`, but this is not the case,
as according to C and C++ standard, `free` should allow `NULL` pointers,
and ignore them.
2014-05-04 15:48:50 +02:00
ridiculousfish
7e44bcfd8a Make inotify-based universal variable notifier tests pass 2014-05-03 19:57:20 -07:00
ridiculousfish
8cbd66b0f9 Merge branch 'death_of_fishd' of https://github.com/fish-shell/fish-shell into death_of_fishd 2014-05-03 19:36:22 -07:00
ridiculousfish
47a81c2b39 Re-establish inotify watch when file is deleted 2014-05-03 16:31:11 -07:00