Commit graph

4322 commits

Author SHA1 Message Date
Mark Griffiths
7b093ee4b3 Lexicon filter: fix 'if' and 'for' special cases 2014-09-03 14:43:25 +01:00
Mark Griffiths
9f75cef5e5 Style fix for sub-line comments 2014-09-03 14:43:25 +01:00
Mark Griffiths
a410c31bf8 Fixes lexicon filter pipes '|" 2014-09-03 14:43:25 +01:00
Mark Griffiths
1cd50ba572 Merged in latest changes to docs and formatting tweaks
Addresses issue #1557 as well as fixing many typos, HTML errors and
inconsistencies. Also introduces automatic syntax colouring and enables
new documentation to be written in Markdown. TODO fix Tutorial.
2014-09-03 14:43:25 +01:00
Mark Griffiths
1052eeee8c Simplify styling 2014-09-03 14:43:25 +01:00
Mark Griffiths
e22f0dda32 Removed dupes from gitignore 2014-09-03 14:43:24 +01:00
Mark Griffiths
766a6b8309 Added some clutter
Subllime and a few temporary files.
2014-09-03 14:43:24 +01:00
Mark Griffiths
d282bc4625 Documentation update
Rework for Doxygen >1.8. Moved large parts of the documentation to a
simplified format, making use of Markdown enhancements and fixing bad
long options.
2014-09-03 14:43:24 +01:00
Chris Wolfe
677cee44ad failiure/failure
Fix misspelling of failure in the fish shell design doc
2014-09-03 14:48:21 +02:00
Mark Griffiths
60e7726832 Merge branch 'master' into documentation-update 2014-09-03 13:14:25 +01:00
Mark Griffiths
385b00a468 Formatting updates 2014-09-03 13:06:49 +01:00
Kevin Ballard
1c4223889b Fix test output for complete -e tests
GNU sort behaves stupidly when LC_ALL is not C. This caused the test
output to be sorted wrong.
2014-09-02 15:52:56 -07:00
Kevin Ballard
90a4fd34d2 Add tests for the various complete -e changes 2014-09-02 15:30:58 -07:00
Kevin Ballard
2820c7a9cd Erase all completions with complete -c foo -e
When passing `-e` to `complete -c foo` without any other options, all
options for the command should be erased.

Fixes #380.
2014-09-02 15:30:58 -07:00
Kevin Ballard
edd4f3d5ad Don't erase old-style options with complete -l foo -e
When erasing long option completions, distinguish between gnu-style and
old-style options, just like we do when adding and printing completions.
2014-09-02 15:30:58 -07:00
Kevin Ballard
aa7fe3b132 Don't erase all long opts with complete -e
When using `complete -c foo -l bar -e`, all long options for the command
were being erased because it was also comparing the short option, which
was 0.
2014-09-02 15:30:58 -07:00
Kevin Ballard
1d9886d0f7 Don't segfault when erasing short option completions
When using `complete -s x -e`, the long option is unspecified, which
makes it NULL. Comparing this to a `wcstring` segfaults.

Fixes #1182.
2014-09-02 15:30:51 -07:00
Mark Griffiths
6068e85ef2 Merge branch 'master' into documentation-update 2014-08-30 12:38:57 +01:00
Mark Griffiths
ced471d4ce Supporting files for development 2014-08-30 12:21:46 +01:00
Mark Griffiths
2445ac4a53 Addition of 'ascii fish' logo
+ small fixes
2014-08-30 11:03:02 +01:00
Konrad Borowski
1d0279eac5 Fix F1 binding to work with multiple tokens. 2014-08-30 11:18:56 +02:00
ridiculousfish
f8b21fe199 Merge pull request #1655 from xakon/master
Fix small typo in documentation
2014-08-29 23:21:34 -07:00
Christos Kontas
0f330d7226 Fix small typo in documentation 2014-08-30 08:03:24 +02:00
Nikolai Aleksandrovich Pavlov
cb29350954 Fix fish_vi_mode.fish 2014-08-29 13:15:13 -07:00
Kevin Ballard
7fce9e2411 Trim trailing newline on cmdsubst when IFS=''
When $IFS is empty, command substitution no longer splits on newlines.
However we still want to trim off a single trailing newline, as most
commands will emit a trailing newline and it makes it harder to work
with their output.
2014-08-29 12:48:45 -07:00
Kevin Ballard
cc52a59e1a Rework how screen size is tracked
The screen size is fetched after a SIGWINCH is delivered. The current
implementation has two issues:

* It calls ioctl() from the SIGWINCH signal handler, despite ioctl() not
  being a function that is known to be safe to call.
* It's not thread-safe.

Signals can be delivered on arbitrary threads, so we don't know if it's
actually safe to be modifying the cached winsize in response to a
signal. It's also plausible that the winsize may be requested from a
background thread.

To solve the first issue, we twiddle a volatile boolean flag in the
signal handler and defer the ioctl() call until we actually request the
screen size.

To solve the second issue, we introduce a pthread rwlock around the
cached winsize. A rwlock is used because it can be expected that there
are likely to be far more window size reads than window size writes. If
we were using C++11 we could probably get away with atomics, but since
we don't have that (or boost), a rwlock should suffice.

Fixes #1613.
2014-08-29 12:46:03 -07:00
Kevin Ballard
24ac7d2698 Fix commandline behavior in bind functions
When a key is bound to a fish function, if that function invokes
`commandline`, it gets a stale copy of the commandline. This is because
any keys passed to `self-insert` (the default) don't actually get added
to the commandline until a special character is processed, such as the
R_NULL that gets returned after running a binding for a fish command.

To fix this, don't allow fish commands to be run for bindings if we're
processing more than one key. When a key wants to invoke a fish command,
instead we push the invocation sequence back onto the input, followed by
an R_NULL, and return. This causes the input loop to break out and
update the commandline. When it starts up again, it will re-process the
keys and invoke the fish command.

This is primarily an issue with pasting text that includes bound keys in
it. Typed text is slow enough that fish will update the commandline
between each character.

---

I don't know of any way to write a test for this, but the issue can be
reproduced as follows:

    > bind _ 'commandline -i _'

This binds _ to a command that inserts _. Typing the following works:

    > echo wat_is_it

But if you copy that line and paste it instead of typing it, the end
result looks like

    > _echo wat_isit

With this fix in place, the pasted output correctly matches the typed
output.
2014-08-29 12:29:48 -07:00
Kevin Ballard
130619d6b0 Fix $SHLVL
Due to being read-only, SHLVL wasn't being incremented properly for
recursive invocations of fish.
2014-08-29 12:22:35 -07:00
Konrad Borowski
71ab40e536 Add Fossil command completions. 2014-08-29 14:19:55 +02:00
Philipp Klose
7638a7d531 Fix typo in German translation 2014-08-29 11:23:08 +02:00
Kevin Ballard
b92a09d5e7 Fix the assertion failure in expand_variables()
expand_variables() is slightly confused about how to handle last_idx. On
input, it expects it to be the index to start processing at, but when
called recursively it always passes the current index. This means that
it may sometimes pass an index 1 past the end of the input string.
Notably, that happens when typing something like

> echo "$foo

(where "foo" is any string that is not a prefix of some existing
variable name)

Fix this by explicitly defining last_idx as being the last processed
index, meaning the next index to process is actually last_idx-1. This
means we should call it with next.size() instead of next.size()-1.
2014-08-28 13:29:43 -07:00
Mark Griffiths
3d29cc8636 Various additions and fixes 2014-08-27 00:30:08 +01:00
Mark Griffiths
d6c5a1e0c4 Merge branch 'master' into documentation-update
Conflicts (FIXED):
	doc_src/command.txt
	doc_src/index.hdr.in
	doc_src/read.txt
	doc_src/type.txt
2014-08-26 20:05:46 +01:00
Mark Griffiths
9bcd4a6811 Merge remote-tracking branch 'upstream/master' 2014-08-26 19:23:50 +01:00
Mark Griffiths
e90b1651e4 Fish documentation formatting guidelines 2014-08-26 19:19:48 +01:00
Mark Griffiths
66ccae4bfe Consistency fixes 2014-08-26 19:19:24 +01:00
Kevin Ballard
02a07164f3 Make commandline -P actually work
`commandline --paging-mode` worked but the short flags list accidentally
omitted the documented `-P`.
2014-08-24 14:47:05 -07:00
ridiculousfish
9419191aa6 Clean up variable expansion, and properly handle embedded NULs 2014-08-24 14:39:56 -07:00
ridiculousfish
f71b10df8c Don't suggest after | & or in comments
Fixes #1631
2014-08-24 14:39:41 -07:00
ridiculousfish
0b7735d279 Merge pull request #1630 from kballard/expand_variables_in_quoted_strings
Fix various expansions issues with variables
2014-08-23 16:13:25 -07:00
Konrad Borowski
1f3a93a3af
Fix the compilation under gcc 4.9.0.
gcc interpretes C99's compound literals more strictly by invalid the
compound literal on implicit to pointer cast (because of automatic
storage duration, 6.5.2.5.6 in C99 standard draft).

This fixes the issue by not using compound literals at all.
2014-08-22 21:52:41 +02:00
ridiculousfish
f9f773cc28 Comment on why we run 'false' in web_config.py 2014-08-22 12:04:23 -07:00
Kevin Ballard
d9bf53c6e5 Show a non-zero status in the fish_config prompt
When selecting a prompt with fish_config, render the prompt with a
non-zero status so the user knows what it looks like.
2014-08-22 12:00:16 -07:00
Kevin Ballard
f549ada16c Set up fish_{function,complete}_path properly
In the base config.fish, fish_function_path and fish_complete_path have
$__fish_datadir/{functions,completions} added to them if not already
present. For some reason they were replacing the final path component
instead of being added on to the end.
2014-08-22 11:54:58 -07:00
ridiculousfish
d8b955294a Add a test for syntax highlighting pipes 2014-08-22 11:53:20 -07:00
Kevin Ballard
8aad53556d Highlight pipe characters correctly
According to `fish_config`'s colors page, the pipe operator `|` is
supposed to be colored the same as a statement terminator.
2014-08-22 11:45:05 -07:00
Kevin Ballard
61ce9db4ba Make the alias built-in function work better
The new --wraps functionality was breaking aliases of the form
`alias foo='bar baz'`. That is, aliases where the body is multiple
words. Extract the first word of the body and use that instead.

Use better errors for aliases with no name or no body.
2014-08-22 11:40:59 -07:00
ridiculousfish
2da435712a Merge branch 'master' of github.com:fish-shell/fish-shell 2014-08-22 11:39:41 -07:00
Andy Lutomirski
9079ec459c webconfig: fixes for token security
* Use 16-byte tokens
 * Use os.urandom (random.getrandbits shouldn't be used for security)
 * Convert to hex correctly
2014-08-22 15:44:43 +08:00
Andy Lutomirski
aaddccfdb1 webconfig: Use a constant-time token comparison
This prevents a linear-time attack to recover the auth token.
2014-08-22 15:39:13 +08:00