Commit Graph

3684 Commits

Author SHA1 Message Date
ridiculousfish
766176443d Clean up completion removal
Rather than passing a triple of short, long, is_old, pass an option
as a string and then a type
2016-01-16 22:42:14 -08:00
ridiculousfish
3552d073f6 Mark a bit of code as unreachable 2016-01-16 16:03:09 -08:00
ridiculousfish
49d3042bd3 Simplify locking in complete.cpp 2016-01-16 16:00:57 -08:00
ridiculousfish
701d141109 Clean up complete_entry_opt_t
Rather than storing short and long options separately, using
a complicated set of invariants, store them in a single string
and use an explicit type complete_option_type_t to track how they
are interpreted.
2016-01-16 15:46:43 -08:00
ridiculousfish
870593e345 Remove short_opt_str from completion_entry_t
This was a "cache" of dubious value that was also very confusing.
The idea was to express in one place all of the short options that
were allowed for a command, in a big string.  But it's simpler to
just construct that on-demand by walking the list of
complete_entry_opt_t.
Also remove some other dead code as part of cleanup.
2016-01-15 17:27:02 -08:00
ridiculousfish
5cf0e918b0 Clean up short_ok in completions
Preparing to remove short_opt_string
2016-01-15 17:14:44 -08:00
Kevin Ballard
1dac0041d5 Stop unescaping strings with commandline -b
The fix for #2075 inadvertently started unescaping the strings emitted
from `commandline -b`. Only strings emitted with the `-o` flag are
supposed to be unescaped.

Fixes #2210.
2016-01-10 17:25:22 -08:00
Tom Smeding
4417a6ee34 Prevent line-full-of-spaces in s_reset
If you have a prompt preceded by a new line, you'll get a line full of spaces instead of an empty line above your prompt. This doesn't make a difference in normal usage, but copying and pasting your terminal log becomes a pain. This commit clears that line, making it an actual empty line.
2016-01-08 23:38:31 +01:00
Kurtis Rader
ef31aa94f8 clarify the documentation of builtin random
The random builtin command may or may not produce values with a truly
random distribution. So make the documentation reflect that reality. Also,
make the command consistent with similar shells (e.g., bash, zsh) which
produce a range of [0..32767].

Resolves issue #1272.
2016-01-07 20:54:50 -08:00
ridiculousfish
bc3260402a Don't resolve paths for files run from argv
Before this change, `fish ./test.fish` would fully resolve the
relative paths and symlinks of test.fish, as reported by `status -f`.
However `source` would not. With this change, both cases return relative
paths. `realpath` may be used by scripts to resolve them.

Fixes #2643
2016-01-03 12:12:53 -08:00
ridiculousfish
c5ed4e5cdf Pass a struct stat by const reference instead of by value 2016-01-03 12:12:42 -08:00
ridiculousfish
1363c7468d "Stop" should be "stomp" in fish.cpp comment 2015-12-29 16:39:28 -08:00
ridiculousfish
994aba075d Remove some extra newlines from function error messages 2015-12-27 15:55:49 -08:00
Kurtis Rader
979b94e274 only swith to shell tty mode if interactive
My PR #2578 had the unexpected side-effect of altering the tty modes of
commands run via "fish -c command" or "fish scriptname". This change fixes
that; albeit incompletely. The correct solution is to unconditionally set
shell tty modes if stdin is attached to a tty and restore the appropriate
modes whenever an external command is run -- regardless of the path used to
run the external command. The proper fix should be done as part of addressing
issues #2315 and #1041.

Resolves issue #2619
2015-12-27 12:28:19 -08:00
Kurtis Rader
814cb51eb5 improve handling of the escape character
Increase the delay between seeing an escape character and giving up on
whether additional characters that match a key binding are seen. I'm
setting the value to 500 ms to match the readline library. We don't need
such a large window for sequences transmitted by a terminal (even over ssh
where network delays can be a problem).  However, we can't expect humans to
reliably press the escape key followed by another key with an inter-char
delay of less than ~250 ms based on my testing and research. A value of
500 ms provides a nice experience even for people using "fish_vi_mode"
bindings as a half second to switch from insert to normal mode is still
fast enough that most people won't even notice.

Resolves #1356
2015-12-22 17:58:38 -08:00
ridiculousfish
172f1e1b5f getopt long_options to be const 2015-12-21 20:32:05 -08:00
Kurtis Rader
b257e79a07 simplify fish_parse_opt
While investigating issue #2619 my first thought was that the problem
had something to do with the "is_interactive_session" global variable.
That preliminary conclusion appears to be wrong (i.e., the problem
lies elsewhere). However, that hypothesis caused me to look at function
"fish_parse_opt" and other mentions of "is_interactive_session".

I decided to take the opportunity to simplify and improve the style of
"fish_parse_opt" since I just spent an hour reviewing the code that
references "is_interactive_session". For example, the "has_cmd" variable
isn't really needed. And there is inconsistent whitespace not to mention
confusion about bool's versus int's and zero versus NULL.
2015-12-21 20:07:18 -08:00
ridiculousfish
6aa2cbe807 Shave 4 bytes from parse_node_t
Bitfields ftw
2015-12-19 18:09:41 -08:00
ridiculousfish
ad72421b2c Don't define a function if there's an error in function's args
Fixes #2519
2015-12-19 18:03:46 -08:00
ridiculousfish
594b460ba2 Allow and/or statements to attach to the if/while header
For example:

  if false; or true; echo hello; end

will output 'hello' now.

Fixes #1428
2015-12-19 14:49:07 -08:00
ridiculousfish
8c707a4e2f Simplify parser implementation
Rather than returning a list of productions and an index,
return the relevant production directly from the rule function.

Also introduce a tag value (replacing production_idx) which tracks
information like command decorations, etc. with more clarity.
2015-12-19 11:17:13 -08:00
David Adam
7143512198 detect and provide fallback for backtrace_symbols_fd
Closes #2615 to fix includes on FreeBSD and provide fallback on Cygwin.
2015-12-17 20:36:33 +08:00
Kurtis Rader
c68f8f3418 restore the terminal modes before an "exec"
When replacing the existing fish process with a new process it is
important to restore the temrinal modes to what they were when fish
started running. We don't want any tweaks done for the benefit of fish
(e.g., disabling ICRNL mode) to bleed thru to an "exec"ed command.

Resolves #2609
2015-12-15 23:40:53 -08:00
Tanner Bruce
b4b5c2188f Check that $XDG_RUNTIME_DIR is valid and accessible
Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
2015-12-11 15:02:36 +08:00
ridiculousfish
d90169e79b Remove a stale comment regarding fishd 2015-12-10 01:02:57 -08:00
Andy Lutomirski
fea798011b Switch show_stackframe to backtrace_symbols_fd
It's simpler and avoids calling into fprintf in contexts in which
it might crash or deadlock.
2015-12-10 01:02:57 -08:00
Andy Lutomirski
f17a71de74 Don't complain if do_builtin_io fails due to EPIPE
If stdio is dead due to EPIPE, there's no great reason to spew a stack dump.

This will still write an error to stderr if stdout dies.  This might be
undesirable, but changing that should be considered separately.
2015-12-10 01:02:57 -08:00
Kurtis Rader
16c34b387f Ensure interactive tty modes are set ASAP
It is critical that we ensure our interactive tty modes are in effect at
the earliest possible moment. This achieves that goal and is harmless if
stdin is not tied to a tty. The reason for doing this is to ensure that
\r characters are not converted to \n if we're running on the slave side
of a pty controlled by a program like tmux that is stuffing keystrokes
into the pty before we issue our first prompt.
2015-12-08 21:01:31 -08:00
Kurtis Rader
d65c63322e allow \cJ (\n) to be bound separate from \cM (\r)
This makes it possible (on UNIX systems, don't know about MS Windows)
to bind \cJ (\n) independently of \cM (\r, aka [enter]).

Resolves #217
2015-12-08 21:01:31 -08:00
ridiculousfish
6943536ef3 named_color_names to reserve the right amount 2015-12-08 20:32:59 -08:00
Kurtis Rader
7322c9c591 "normal" should appear in set_color --print-colors 2015-12-08 20:08:08 -08:00
Kurtis Rader
dfaefb97ff remove "normal" from the basic color name table
The special token "normal" should not be in the basic sixteen color table
because a) it is not a color, and b) it is special cased with the result of
resetting the terminal colors (usually via a ANSI X3.64 CSI [0m sequence).
2015-12-08 20:08:08 -08:00
Kurtis Rader
0a0acc8a2e add support for ANSI "bright" colors
This adds support for the ANSI x3.64 "bright" colors in the basic sixteen
color palette. This is especially useful when trying to use the base colors
as a background color. The "bright" variants tend to be more useful as
background colors compared to the non-bright variants.

This also fixes a bug in so far as palette number 7 is actually grey and
not white whereas palette number 15 is white. At least on the terminal
emulators on which I've tested this change (Ubuntu xterm & uxterm, Mac
OS X Terminal & iTerm2).

Resolves issue #1464.
2015-12-08 20:08:08 -08:00
ridiculousfish
17672b08c6 Don't print the jobs header when stdout is redirected 2015-12-03 21:08:48 -08:00
Max Nordlund
dc1f2fbb4c Fix the error message not being outputed 2015-12-03 20:59:13 -08:00
Max Nordlund
2d90859cab Fix wrong exit code for jobs #2505 2015-12-03 20:59:12 -08:00
David Adam
ce360bcfe3 env_universal_common.cpp: don't bother trying nonexistent path 2015-11-28 14:34:27 +08:00
David Adam
789657456a env.cpp: warn when wgetcwd() fails
Closes #2321
2015-11-28 14:34:27 +08:00
David Adam
e5bfdcd9a4 fish_tests.cpp: use temporary path for completion tests
Closes #2322
2015-11-27 16:20:54 -08:00
Daniel Matz
bf86a92596 Fix tab completion after '%' character. 2015-11-27 16:07:16 -08:00
ridiculousfish
45dfa2d864 Attempt to fix the sporadic uvar test failures on Linux
We identify when the universal variable file has changed out from under us by
comparing a bunch of fields from its stat: inode, device, size, high-precision
timestamp, generation. Linux aggressively reuses inodes, and the size may be
the same by coincidence (which is the case in the tests). Also, Linux
officially has nanosecond precision, but in practice it seems to only uses
millisecond precision for storing mtimes. Thus if there are three or more
updates within a millisecond, every field we check may be the same, and we are
vulnerable to the ABA problem. I believe this explains the occasional test
failures.

The solution is to manually set the nanosecond field of the mtime timestamp to
something unlikely to be duplicated, like a random number, or better yet, the
current time (with nanosecond precision). This is more in the spirit of the
timestamp, and it means we're around a million times less likely to collide.
This seems to fix the tests.
2015-11-08 23:48:32 -08:00
ridiculousfish
e7d18b96f9 Make input_mapping_execute stop returning R_NULL too often
input_mapping_execute, when passed false for allow_commands, will return
R_NULL. However currently it does this unconditionally, even if we don't
have any commands. This defeats our read-ahead optimization, so we
always read and process one byte at a time. This caused pasting to be
much slower.

Fixes #2215
2015-11-07 15:23:36 -08:00
ridiculousfish
1854ef9823 Teach the cd autosuggestion how to descend "unique" hierarchies
If we are cd'ing into a directory, and the directory has only one
child which is itself a directory, the autosuggestion should
descend as far as it can.

Fixes #2531
2015-11-07 13:58:13 -08:00
ridiculousfish
d5f3a09ce9 Make 'set -ql' search up to function scope
Previously 'set -ql' would only look for variables in the
immediate local scope. This was not very useful. It's also
arguably surprising, since a 'set -l' in a function, followed
by a 'set -ql' in a child block, would fail. There was also no
way to check for a function-scoped variable, since omitting the
scope would also pull in global variables.

We could revisit this and introduce an explicit function scope.

Fixes #2502
2015-10-23 15:15:39 -07:00
ridiculousfish
036a29acf5 Revert "reader.cpp: send carriage return after printing the window title"
This fix introduced #2499
This reverts commit 13479fbc2a.
2015-10-21 12:41:07 -07:00
David Adam
13479fbc2a reader.cpp: send carriage return after printing the window title
Terminals can get confused by all the non-printed characters about the
line position.

Closes #2453.
2015-10-16 11:53:51 +08:00
Jeff Kowalski
226cdc6a28 Fix usage of history_filename 2015-10-16 07:40:04 +08:00
Jeff Kowalski
b13f0701a4 Migrate fish_history from config to data dir
New implementation of migration code within the history_t class will
copy the contents of the old fish_history found in the config directory
to its new location in the data directory.  The old file is left intact.

This is done only in the event that a fish_history is not already found in
the data directory ($XDG_DATA_HOME/fish or ~/.local/share/fish).
2015-10-16 07:40:04 +08:00
Jeff Kowalski
4c2cc384d2 Correct tests for new location of fish_history
The fish_history file is now located in the "data"
directory ($XDG_DATA_HOME/fish or ~/.local/share/fish),
accessible using the function `path_get_data`.

(This commit also cleans trailing whitespace in the source file.)
2015-10-16 07:40:04 +08:00
Jeff Kowalski
2971887bbd Access fish_history from $XDG_DATA_HOME
Add new functions path_get_data and path_create_data which parallel existing
functions path_get_config and path_create_data.  The new functions refer to
XDG_DATA_HOME, if it is defined, or ./local/share if not.

Modify history_filename to use the new function path_get_data.

As a consequence, fish_history will now be located in XDG_DATA_HOME,
not XDG_CONFIG_HOME.

Note that these changes mirror what is already used in
fish-shell/share/tools/create_manpage_completions.py, which stores the
completions in XDG_DATA_HOME

This change matches recommendations in the xdg basedir spec at
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
($XDG_DATA_HOME defines the base directory relative to which user specific data
files should be stored. If $XDG_DATA_HOME is either not set or empty, a default
equal to $HOME/.local/share should be used.)

It addresses suggestions from the following issues:

1. Don't put history in $XDG_CONFIG_HOME (closes #744)
   https://github.com/fish-shell/fish-shell/issues/744

2. Fish is placing non-config files in $XDG_CONFIG_HOME #1257
   https://github.com/fish-shell/fish-shell/issues/1257

3. Move non-config data out of $XDG_CONFIG_HOME #1669
   https://github.com/fish-shell/fish-shell/issues/1669
2015-10-16 07:39:49 +08:00
David Adam
9788566ba4 Revert "reader.cpp: send smkx/rmkx when entering/leaving interactive mode"
This reverts commit a66d44054c due to
https://github.com/fish-shell/fish-shell/issues/2406 - entering keypad
mode causes various terminals to send undocumented and highly variable
escapes for keys not specified in the terminfo specification.
2015-10-15 16:20:25 +08:00
ridiculousfish
d9d2f61ba6 When autoloading a completion, also autoload the function
Fixes a case where a --wraps declaration would be missed
because the function would not be loaded. Fixes #2466.
2015-10-07 18:59:41 -07:00
ridiculousfish
e8605cb3ef Fix a dereference-past-the-end bug in read_redirection_or_fd_pipe
Fixes #2464. Credit to zanchey for reporting it and ASAN for finding it!
2015-10-07 11:38:13 -07:00
ridiculousfish
aeaacedf75 Don't do intermediate fuzzy directory matching with $PATH
When expanding an executable with $PATH, don't attempt to
interpret the directories in PATH as fuzzy matching. Fixes #2413.
2015-10-03 15:44:57 -07:00
Fredrik Fornwall
d98b6f2434 Only include <spawn.h> if HAVE_SPAWN_H
This fixes building on platforms such as Android
which lacks <spawn.h>.

Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
2015-10-02 08:57:05 +08:00
Ian Ray
9ecd73d956 Generate version numbers for Xcode builds
Teach Xcode to run new script xcode_version_gen.sh before building
the fish_shell and fish_indent targets.  The script generates file
fish-build-version.h for inclusion by fish_version.cpp.

Note that Xcode always runs the script because of the phony target
named force-fish-build-version.h, but fish-build-version.h is only
touched if the contents of FISH-BUILD-VERSION-FILE change.

Fixes #890
2015-09-29 14:55:51 -07:00
ridiculousfish
71e38dec11 Fix a typo 2015-09-27 17:33:00 -07:00
ridiculousfish
11376ae25b Fix for recursive wildcard expansion ignoring directories
When ascending out of a directory, we need to clear the directory
from the visited set. Fixes #2414.
2015-09-27 17:19:52 -07:00
ridiculousfish
dd245f62f0 Trailing slashes in wildcards need to match directories
Fixes the wrong sense in a waccess test.
2015-09-27 17:19:52 -07:00
ridiculousfish
f086bc9564 Maintain ownership when rewriting universal variables file
Fixes #2176
2015-09-26 15:24:55 -07:00
ridiculousfish
871a2088db Preserve existing file permissions when rewriting a history file
Fixes #2335
2015-09-26 02:19:51 -07:00
ridiculousfish
abeaac6632 Teach builtin_string to recognize redirections, not just pipes
Allows cases like `string split \n < file.txt` to work.
Fixes 2422
2015-09-25 14:19:15 -07:00
Michael Steed
8abb19aaca Prefix errors with 'string:', not 'string string:' 2015-09-24 19:21:09 -06:00
ridiculousfish
c1bd3b5824 Eliminate global variables associated with builtin IO
This change eliminates global variables like stdout_buffer. Instead we wrap up
the IO information into a new struct io_streams_t, and thread that through
every builtin. This makes the intent clearer, gives us a place to hang new IO
data, and eliminates the ugly global state management like builtin_push_io.
2015-09-22 18:08:00 -07:00
ridiculousfish
1883e051ba Apply some care regarding overflow in string sub 2015-09-21 16:41:26 -07:00
ridiculousfish
4825afbf58 Include headers needed on Linux 2015-09-21 16:41:26 -07:00
ridiculousfish
ad8c7b9d0b Clarify string split implementation
Use some template magic to handle the forward and reverse
string split cases uniformly
2015-09-21 16:41:26 -07:00
ridiculousfish
7eb88ed7dc Take advantage of find_first_not_of and friends
Simplifies some of the logic in string_trim
2015-09-21 16:41:26 -07:00
ridiculousfish
6afd0d8add pcre2_strerror should use wcstring instead of static wchar_t 2015-09-21 16:41:26 -07:00
ridiculousfish
bfe142fef0 Use append_formatv in string_error 2015-09-21 16:41:26 -07:00
ridiculousfish
54e626f665 Fix some type conversion warnings in builtin_string
Also pass around a wcstring for storage, instead of using a static
2015-09-21 16:41:26 -07:00
ridiculousfish
b2e8967e94 Migrate builtin_string.cpp to its own object file
This keeps the architecture a little less surprising
2015-09-21 16:41:25 -07:00
Michael Steed
d83ef07ca7 Merge new string builtin
This adds the new builtin 'string' which supports various string
manipulation and matching algorithms, including PCRE based regular
expressions.

Fixes #2296

Squashed commit of the following:

commit 4c3eaeb6e57d76463e9683c327142b0aeafb92b8
Author: ridiculousfish <corydoras@ridiculousfish.com>
Date:   Sat Sep 12 12:51:30 2015 -0700

    Remove testdata and doc dirs from pcre2 source

commit b2a8b4b50f2398b204fb72cfe4b5ba77ece2e1ab
Merge: 11c8a47 7974aab
Author: ridiculousfish <corydoras@ridiculousfish.com>
Date:   Sat Sep 12 12:32:40 2015 -0700

    Merge branch 'string' of git://github.com/msteed/fish-shell into string-test

commit 7974aab6d3
Author: Michael Steed <msteed@saltstack.com>
Date:   Fri Sep 11 13:00:02 2015 -0600

    build pcre2 lib only, no docs

commit eb20b43d2d
Merge: 1a09e70 5f519cb
Author: Michael Steed <msteed68@gmail.com>
Date:   Thu Sep 10 20:00:47 2015 -0600

    Merge branch 'string' of github.com:msteed/fish-shell into string

commit 1a09e709d0
Author: Michael Steed <msteed68@gmail.com>
Date:   Thu Sep 10 19:58:24 2015 -0600

    rebase on master & address the fallout

commit a0ec9772cd
Author: Michael Steed <msteed68@gmail.com>
Date:   Thu Sep 10 19:26:45 2015 -0600

    use fish's wildcard_match() for glob matching

commit 64c25a01e3
Author: Michael Steed <msteed68@gmail.com>
Date:   Thu Aug 27 08:19:23 2015 -0600

    some fixes from review

    - string_get_arg_stdin(): simplify and don't discard the argument when
      the trailing newline is absent
    - fix calls to pcre2 for e.g. string match -r -a 'a*' 'b'
    - correct test for args coming from stdin

commit ece7f35ec5
Author: Michael Steed <msteed68@gmail.com>
Date:   Sat Aug 22 19:35:56 2015 -0600

    fixes from review

    - Makefile.in: restore iwyu target
    - regex_replacer_t::replace_matches(): correct size passed to realloc()

commit 9ff7477a92
Author: Michael Steed <msteed68@gmail.com>
Date:   Thu Aug 20 13:08:33 2015 -0600

    Minor doc improvements

commit baf4e096b2
Author: Michael Steed <msteed68@gmail.com>
Date:   Wed Aug 19 18:29:02 2015 -0600

    another attempt to fix the ci build

commit 896a2c2b27
Author: Michael Steed <msteed68@gmail.com>
Date:   Wed Aug 19 18:03:49 2015 -0600

    Updates after review comments

    - make match/replace without -a operate on the first match on each
      argument
    - use different exit codes for "no operation performed" and errors, as
      grep does
    - refactor regex compile code
    - use human-friendly error messages from pcre2
    - improve error handling & reporting elsewhere
    - add a few tests
    - make some doc fixes
    - some simplification & cleanup
    - fix ci build failure (I hope)

commit efd47dcbda
Author: Michael Steed <msteed68@gmail.com>
Date:   Wed Aug 12 00:26:07 2015 -0600

    fix dependencies for parallel make

commit ed0850e2db
Author: Michael Steed <msteed68@gmail.com>
Date:   Tue Aug 11 23:37:22 2015 -0600

    Add missing pcre2 files + .gitignore

commit 9492e7a7e9
Author: Michael Steed <msteed68@gmail.com>
Date:   Tue Aug 11 22:44:05 2015 -0600

    add pcre2-10.20 and update license.hdr

commit 1a60b93371
Author: Michael Steed <msteed68@gmail.com>
Date:   Tue Aug 11 22:41:19 2015 -0600

    add string builtin files

    - string builtin source, tests, & docs
    - changes to configure.ac & Makefile.in

commit 5f519cb2a2
Author: Michael Steed <msteed68@gmail.com>
Date:   Thu Sep 10 19:26:45 2015 -0600

    use fish's wildcard_match() for glob matching

commit 2ecd24f795
Author: Michael Steed <msteed68@gmail.com>
Date:   Thu Aug 27 08:19:23 2015 -0600

    some fixes from review

    - string_get_arg_stdin(): simplify and don't discard the argument when
      the trailing newline is absent
    - fix calls to pcre2 for e.g. string match -r -a 'a*' 'b'
    - correct test for args coming from stdin

commit 45b777e4dc
Author: Michael Steed <msteed68@gmail.com>
Date:   Sat Aug 22 19:35:56 2015 -0600

    fixes from review

    - Makefile.in: restore iwyu target
    - regex_replacer_t::replace_matches(): correct size passed to realloc()

commit 981cbb6ddf
Author: Michael Steed <msteed68@gmail.com>
Date:   Thu Aug 20 13:08:33 2015 -0600

    Minor doc improvements

commit ddb6a2a8fd
Author: Michael Steed <msteed68@gmail.com>
Date:   Wed Aug 19 18:29:02 2015 -0600

    another attempt to fix the ci build

commit 1e34e3191b
Author: Michael Steed <msteed68@gmail.com>
Date:   Wed Aug 19 18:03:49 2015 -0600

    Updates after review comments

    - make match/replace without -a operate on the first match on each
      argument
    - use different exit codes for "no operation performed" and errors, as
      grep does
    - refactor regex compile code
    - use human-friendly error messages from pcre2
    - improve error handling & reporting elsewhere
    - add a few tests
    - make some doc fixes
    - some simplification & cleanup
    - fix ci build failure (I hope)

commit 34232e152d
Author: Michael Steed <msteed68@gmail.com>
Date:   Wed Aug 12 00:26:07 2015 -0600

    fix dependencies for parallel make

commit 00d7e78169
Author: Michael Steed <msteed68@gmail.com>
Date:   Tue Aug 11 23:37:22 2015 -0600

    Add missing pcre2 files + .gitignore

commit 4498aa5f57
Author: Michael Steed <msteed68@gmail.com>
Date:   Tue Aug 11 22:44:05 2015 -0600

    add pcre2-10.20 and update license.hdr

commit 290c58c72e
Author: Michael Steed <msteed68@gmail.com>
Date:   Tue Aug 11 22:41:19 2015 -0600

    add string builtin files

    - string builtin source, tests, & docs
    - changes to configure.ac & Makefile.in
2015-09-21 16:41:25 -07:00
ridiculousfish
fa4ec55c96 Fix process expansion on OS X
Puts back sys/sysctl.h header, so we know to use BSD style process
expansion
2015-09-15 11:40:20 -07:00
ridiculousfish
f5093f1625 Fix tests under certain vswprintf calls
Work around an issue where vswprintf may not append
ANY_STRING from a format specifier
2015-09-12 16:32:52 -07:00
ridiculousfish
025b45b91e Don't crash on complete -C in non-interactive mode
Fixes #2361
2015-09-10 18:08:42 -07:00
David Adam
a66d44054c reader.cpp: send smkx/rmkx when entering/leaving interactive mode
Closes #2139.
2015-09-10 16:22:39 +08:00
ridiculousfish
babc6f0f9c Stop exporting fish configuration directories (argh) 2015-09-09 16:50:05 -07:00
Fabian Homborg
b85a8bbbfe Rename sgrep to __fish_sgrep
Makes it harder to cause issues with aliases, see fish-shell#2245
2015-09-09 20:55:04 +02:00
Chris Pick
c5bc221b27 Use the $TERM value from fish's computed environment for ncurses setup
Previously, the process's inherited $TERM value would be used.
This prevented users from being able to set $TERM in their config.fish files.

To make matters worse, the error message would print the computed $TERM value,
giving the mistaken impression that it was being used.

Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
2015-09-09 17:06:13 +08:00
Corey Ford
54b6a1c08e Fix error message for variable used as command 2015-09-03 21:42:42 -07:00
Chris Pick
8cc154bc48 Fix non-zero arity functions followed by other functions
Temporarily skip any queued function code characters when reading
the current function's arguments.

Fixes #2357.
2015-09-03 15:15:46 -04:00
David Adam
b0504f7739 env_universal_common: always pick shmem strategy on Cygwin
Cygwin FIFOs do not support more than one reader, so avoid them on this
platform. An autoconf feature test would be helpful but is tricky to
write.

Closes #2152.
2015-08-24 18:45:57 +08:00
ridiculousfish
b59904632d Rewrite parse_util_unescape_wildcards
Make it simpler, and use wcstring instead of wcsdup
2015-08-19 11:35:24 -07:00
ridiculousfish
c1b9b27f86 Remove unused original_pid variable 2015-08-18 11:22:05 -07:00
ridiculousfish
e2f16ec20e Define a constant for function-not-found in input.cpp
Avoids differences in widths of wchar_t, hopefully addressing
issue #2284
2015-08-16 18:45:42 -07:00
ridiculousfish
93d57bd73a Factor function environment preparation into its own function 2015-08-15 13:37:17 -07:00
ridiculousfish
871a822379 Remove some dead #defines 2015-08-11 01:00:05 -07:00
ridiculousfish
b9b6b6108e Dead macro cleanup
Enable -Wunused-macros, and remove said unused macros
2015-08-10 22:01:50 -07:00
ridiculousfish
3a2ba60b70 Use ++iter, not iter++ in input.cpp 2015-08-10 22:01:33 -07:00
ridiculousfish
aa76f64a94 Correct the caret position for unbalanced square brackets 2015-08-10 19:30:21 -07:00
ridiculousfish
e34a8da5d7 Correct the positioning of the error caret
When an error occurs midway through a token, like abc(def,
make the caret point at the location of the error (i.e. the paren)
instead of at the beginning of the token.
2015-08-10 18:31:20 -07:00
ridiculousfish
3bd6eab88f Make expansion test robust against different filesystem orders
Should make the tests pass on Linux
2015-08-08 15:25:07 -07:00
ridiculousfish
3a3a9f5cc1 Add wreaddir_for_dirs function
Eliminates some stat calls, speeding up wildcard expansion
2015-08-08 14:52:04 -07:00
ridiculousfish
f87268e2ac Remove a bogus function declaration 2015-08-08 14:32:10 -07:00
ridiculousfish
6347988e0a Eliminate wildcard_expand function 2015-08-08 13:55:51 -07:00
ridiculousfish
b92acd3cf2 Initial implementation of intermediate fuzzy completion
e.g. /u/l/b<tab> may be expanded to /usr/local/bin
2015-08-08 13:55:51 -07:00
ridiculousfish
fd96bafbc8 Experiment to rework wildcard matching
Preparation for zsh-style intermediate component
tab completion
2015-08-08 13:55:51 -07:00
ridiculousfish
b7e16cb0dd Tweak try_add_completion_result logic
Preparation for zsh-style intermediate fuzzy matching
2015-08-08 13:55:51 -07:00
ridiculousfish
459df23931 Migrate the prepend_token_prefix logic into the expander 2015-08-08 13:55:50 -07:00
ridiculousfish
e7b22a7ed2 Factor the expander class a bit more 2015-08-08 13:55:50 -07:00
ridiculousfish
bcbe91461e Move the "wildcard_complete" test into wildcard_test_flags_then_complete
Simplifies code yet further
2015-08-08 13:55:50 -07:00
ridiculousfish
b68410d619 Eliminate the wildcard_expand_internal function 2015-08-08 13:55:50 -07:00
ridiculousfish
602e9cebd9 rename FOR_COMPLETIONS to EXPAND_FOR_COMPLETIONS
This is yet clearer
2015-08-08 13:55:50 -07:00
ridiculousfish
d2049edcab Slight refactoring of expander's return code implementation 2015-08-08 13:55:49 -07:00
ridiculousfish
83322f63c6 Rewrite wildcard_complete_internal to be easier to follow 2015-08-08 13:55:49 -07:00
ridiculousfish
f0a2f24701 Remove some dead code 2015-08-08 13:55:49 -07:00
ridiculousfish
97f1a8fe91 Factor the completion prefix behavior into its own function
In a few places, we need to add a prefix to completions that
replace the token. This change factors that logic into its
own function prepend_token_prefix.
2015-08-08 13:55:49 -07:00
ridiculousfish
0ac9f159d6 Eliminate recurse_to_subdirectories function 2015-08-08 13:55:49 -07:00
ridiculousfish
a3f8e27bf8 rename ACCEPT_INCOMPLETE to FOR_COMPLETIONS, which is clearer 2015-08-08 13:55:49 -07:00
ridiculousfish
b55c13f275 Turn on the new wildcard expander 2015-08-08 13:55:48 -07:00
ridiculousfish
761651d410 Add some expansion tests 2015-08-08 13:55:48 -07:00
ridiculousfish
70548f7cc7 Initial implementation of wildcard match refactoring
Not yet turned on.
2015-08-08 13:55:43 -07:00
ridiculousfish
bc8a34f8df Add a missing typecast 2015-08-08 10:35:17 -07:00
Tom Smeding
8f0cd5508d Fix wrong max argument list size reporting 2015-08-08 10:09:33 -07:00
David Adam
e56f0628d5 common.cpp: check wcwidth for supported characters
Rather than trying to detect Unicode support from the environment, check
the printable width of characters in the current locale before deciding
on whether to use them.

Closes #1927.
2015-08-03 14:18:06 +08:00
David Adam
a6a16808e3 Merge branch 'iwyu'
http://include-what-you-use.org/
2015-07-29 09:30:19 +08:00
ridiculousfish
aee71b594b Remove unused unload_all function 2015-07-27 23:36:54 -07:00
ridiculousfish
6e3231a9d7 Stop passing mutable references to completions around
Replace uses of vector<completion_t>& with vector<completion_t>*
This makes it clear at the call site that the object may be mutated.
2015-07-27 18:45:47 -07:00
ridiculousfish
85dad6913e Support file tab completion after = and : separators
For example, env VAR=/usr<tab> will now work as expected

Fixes #2178
2015-07-27 13:43:20 -07:00
ridiculousfish
deacec07bf Fix a warning with g++ about an unused function result 2015-07-26 10:55:19 -07:00
David Adam
958880d972 src/wutil: drop <features.h> header, _BSD_SOURCE is defined by the compiler 2015-07-26 19:58:02 +08:00
ridiculousfish
78af59f40c Handle getcwd failures to satisfy the linter 2015-07-26 02:15:59 -07:00
ridiculousfish
c59f5e9f01 Cast getcwd() to void to defeat a warning 2015-07-26 02:14:06 -07:00
ridiculousfish
c9349f2ef6 Continue to refine tokenizer interface
Migrate some functions into tokenizer instance methods
2015-07-26 00:58:32 -07:00
ridiculousfish
4ebaa7b6bd Continue migration to the new tokenizer interface 2015-07-26 00:12:36 -07:00
ridiculousfish
618896c043 Early reworking of tokenizer interface 2015-07-25 23:05:47 -07:00
ridiculousfish
0dbd83ffaf Remove some dead code 2015-07-25 22:47:44 -07:00
David Adam
3929e9de0e Merge branch 'master' into iwyu 2015-07-26 10:20:13 +08:00
ridiculousfish
f4d1657c22 Eliminate wgetopt global variables
Replace them with a new struct wgetopter_t that uses
instance variables instead.
2015-07-25 18:16:34 -07:00
ridiculousfish
ac72db8ef0 Make our wgettext() implementation a little less terrifying
Use wchar_t* directly instead of wcstring.c_str()
2015-07-25 16:01:59 -07:00
ridiculousfish
1786a7cdc4 Use the address-of operator when checking for weak symbols
This fixes a warning with gcc on OS X
2015-07-25 13:02:58 -07:00
ridiculousfish
a91e8887cd Migrate source files into src/ directory
This change moves source files into a src/ directory,
and puts object files into an obj/ directory. The Makefile
and xcode project are updated accordingly.

Fixes #1866
2015-07-25 12:31:57 -07:00
ridiculousfish
b4f53143b0 Migrate source files into src/ directory
This change moves source files into a src/ directory,
and puts object files into an obj/ directory. The Makefile
and xcode project are updated accordingly.

Fixes #1866
2015-07-24 00:59:27 -07:00