Commit Graph

4763 Commits

Author SHA1 Message Date
ridiculousfish
e395a0eb69 Migrate PATH-completion logic from complete.cpp to expand.cpp
Prior to this fix, when completing a command that doesn't have a /, we
would prepend each component of PATH and then expand the whole thing. So
any special characters in the PATH would be interpreted when performing
tab completion.

With this fix, we pull the PATH resolution out of complete.cpp and
migrate it to expand.cpp. This unifies nicely with the CDPATH resolution
already in that file. This requires introducing a new expand flag
EXPAND_SPECIAL_FOR_COMMAND, which is analogous to EXPAND_SPECIAL_CD
(which is renamed to EXPAND_SPECIAL_FOR_CD). This flag tells expand to
resolve paths against PATH instead of the working directory.

Fixes #952
2016-04-07 20:15:32 -07:00
Aaron Gyes
790c7f80c7 Implement an --invert/-v for string match, like grep -v.
Only lines that do not match the pattern are shown.
2016-04-08 10:49:29 +08:00
ridiculousfish
155befe90e Complain less about "bogus" PATH entries
When determining the old path, get the existing value in any scope,
not just the set scope. Also only complain about absolute paths:
relative paths are expected to be invalid sometimes.
2016-04-07 15:44:56 -07:00
ridiculousfish
d2ae00ca44 Remove a dead function bool_from_env_var 2016-04-07 13:29:50 -07:00
Kurtis Rader
02f18cae0a fix setting of $argv for source w/no args
Fixes #139
2016-04-06 13:04:44 -07:00
Kurtis Rader
4ff8e6e781 change how redirections are formatted
Modify `fish_indent` to emit redirections without a space before the target of
the redirection; e.g., "2>&1" rather than "2>& 1" as the former is clearer to
humans.

Fixes #2899
2016-04-05 19:29:23 -07:00
Aaron Gyes
a4642f141f don't try to use st_gen (inode generation) number
Per discussion in pull-request #2891, it's not available on Linux (we just
fill it with zero), and unless run as root on OS X (or other BSD system) it
will be zero. Remove it from file_id_t. Also fix the initialization of the
file_id_t structure.

Fixes #2891
2016-04-04 20:17:05 -07:00
Kurtis Rader
8f33b55ccc remove unused special color "ignore"
Resolve lint warning about unused method "rgb_color_t::ignore()".

Fixes #2893
2016-04-04 16:55:40 -07:00
Kurtis Rader
47f1a92cc4 fixes for cppcheck lint warnings
Refine the linting behavior.

Fix several of the, mostly trivial, lint errors.
2016-04-04 14:34:28 -07:00
Kurtis Rader
411d573ba9 convert atypical env_universal_common logging
This is a quick and dirty conversion of the atypical, and undocumented,
logging done by env_universal_common.cpp to the usual `debug()` pattern. I
didn't want to drop the messages because they could be useful when
debugging future issues. So I simply converted them to the lowest debug
level using the normal debug() function.

Fixes #2887
2016-04-03 20:23:43 -07:00
Kurtis Rader
9dd6873e58 lint: remove or comment out unused functions
Cppcheck has identified a lot of unused functions. This removes funcs that
are unlikely to ever be used. Others that might be useful for debugging I've
commented out with "#if 0".
2016-04-03 19:02:46 -07:00
Kurtis Rader
3f1fc332e7 remove unused wgetopt() method found by linting 2016-04-02 22:18:31 -07:00
ridiculousfish
bb5608e920 Remove an unnecessary c_str() 2016-03-27 18:01:19 -07:00
Andreas Nordal
6495bd470d Fix memory leaks at exit found in tests
This fixes all memory leaks found by compiling with
clang++ -g -fsanitize=address and running the tests.

Method:
Ensure that memory is freed by the destructor of its respective container,
either by storing objects directly instead of by pointer, or implementing
the required destructor.
2016-03-27 17:40:48 -07:00
Kurtis Rader
de1258e09b fish --version should write to stdout
When explicitly asking for the fish version string the information
should go to stdout rather than stderr. Also, there is no reason to use
exit_without_destructors() rather than exit() in that code path. We
actually want the side-effects of exit() such as flushing stdout and
there aren't any threads or other things that could cause a normal exit
to fail when that function is run.
2016-03-23 11:42:17 -07:00
Andreas Nordal
2a4a539d86 Fix memory leak, error message when failing to open input file
The early return skipped all cleanup.
This problem is a case for the classic "goto fail" paradigm, but this
change instead makes a few adjustments to take advantage of a previously
unused level of indentation to conditionally execute the success path.

The error message now prints the filename instead of "open",
which should be more idiomatic.

Tip:
This patch makes sense if viewed with `git show --ignore-space-change`.
2016-03-22 11:43:58 -07:00
Federico Ferri
168a156e58 implement swap-selection-start-stop function
The swap-selection-start-stop function goes to the other end of the highlighted text, the equivalent of `o' for vim visual mode.

Add binding to the swap-selection-start-stop function, `o' when in visual
mode.

Document swap-selection-start-stop, begin-selection, end-selection, kill-selection.
2016-03-20 19:22:04 -07:00
Kurtis Rader
c2f1df1d4a fix handling of non-ASCII chars in C locale
The relevant standards allow the mbtowc/mbrtowc functions to reject
non-ASCII characters (i.e., chars with the high bit set) when the locale
is C or POSIX.  The BSD libraries (e.g., on OS X) don't do this but
the GNU libraries (e.g., on Linux) do. Like most programs we need the
C/POSIX locales to allow arbitrary bytes. So explicitly check if we're
in a single-byte locale (which would also include ISO-8859 variants)
and simply pass-thru the chars without encoding or decoding.

Fixes #2802.
2016-03-20 18:47:38 -07:00
David Adam
03460a3928 env_universal_common: use uid_t in geteuid checks
The u_int typedef fails to compile on all platforms (e.g. Windows). It
is part of the code imported from tmux.

Update it to the SUS-standard uid_t.

Closes #2821.
2016-03-18 15:53:29 -07:00
Andreas Nordal
f20e8420a8 parse_execution.cpp: Remove line continuations
My IDE (Kdevelop 4.7.3) didn't tackle them.
2016-03-17 16:37:52 -07:00
Jeff Kowalski
a7012648fe Improve error handling around fchown
Address the feedback from the prior commit:
- Change the sense of return value testing to match more common
comparison idiom
- Test result of fchmod as well as fchown
- Change sense of return value testing around wrename as well
- Include errno where possible in error message
2016-03-12 12:26:01 -08:00
Jeff Kowalski
46b9f263ac Handle return values from fchown
The function fchown is annotated with warn_unused_result.  As
formerly used in the code, it would emit a compiler warning
```warning: ignoring return value of ‘fchown’, declared with
attribute warn_unused_result [-Wunused-result]```

This commit notes the return value and emits appropriate error/logging
messages if the call fails, creating more traceable results and
satisfying the compiler.
2016-03-12 11:21:52 -08:00
Kurtis Rader
6a16bdb808 assume getopt/getopt_long is available
There is no longer a good reason to detect whether or not getopt_long()
is available. All UNIX implementations we're likely to run on have it. And
if we ever find one that doesn't the right thing to do is not fallback to
getopt() but to include the getopt_long() source in our package like we
do with the pcre2 library. Since it's licensed under LGPL we can legally
do so if it becomes necessary.

This partially addresses issue #2790.
2016-03-08 13:38:57 -08:00
ridiculousfish
6bee85fefa expand_string should not return any results on error
Fixes #2796
2016-03-05 21:50:05 -08:00
ridiculousfish
a37d4d809e Save a few string allocations when importing environment variables 2016-03-05 19:07:00 -08:00
ridiculousfish
3044697baa Prefer the first, not last, of any env var duplicates
If envp contains duplicate environment variables, use the
first value, not the last value. Fixes #2784.
2016-03-05 19:02:50 -08:00
ridiculousfish
1e7c3fe709 A few fixes suggested by Coverity Scan 2016-03-03 18:49:24 -08:00
ridiculousfish
58d56f91f3 Tweak UTF8 decoding interface
Previously, when decoding UTF-8, we would first run through the
array to compute the correct size, then allocate a buffer of that size,
then run through the array again to fill the buffer, and then copy it
into a std::wstring. With this fix we can copy it into the string
directly, reducing allocations and only requiring a single pass.
2016-03-02 11:24:23 -08:00
Kurtis Rader
f2246dfb34 reduce number of Unicode private-use characters
This narrows the range of Unicode codepoints fish reserves for its own
use from U+E000 thru U+F8FE (6399 codepoints) to U+F600 thru U+F73F (320
codepoints). This is still not ideal since fish shouldn't be using any
Unicode private-use codepoints but it's a step in the right direction.

This partially addresses issue #2684.
2016-02-28 18:36:34 -08:00
ridiculousfish
9151ec7092 Eliminate narrow_string_rep_t
This was used to cache a narrow string representation
of commands, so that if certain system calls returned errors
after fork, we could output error messages without allocating
memory. But in practice these errors are very uncommon, as are
commands that have wide characters. It is simpler to do a best-effort
output of the wide string, instead of caching a narrow string
unconditionally.
2016-02-28 01:38:28 -08:00
ridiculousfish
3633c51ad8 Re-use the parse tree generated during error detection for execution
Prior to this fix, read_ni would use parse_util_detect_errors
to lint the script to run, and then parser_t::eval() to execute it.
Both functions would parse the script into a parse tree. This allows
us to re-use the parse tree, improving perfomance.
2016-02-28 00:44:20 -08:00
ridiculousfish
e3970f9cbb Allow parse_execution_context to take ownership of a parse tree
Introduces a new template moved_ref which is like an rvalue reference.
This allows passing around objects while being explicit that the
receiver may acquire ownership. This will help reduce some allocations.
2016-02-28 00:33:11 -08:00
ridiculousfish
077757a30b Add missing #include guards in FISH_PAGER_H 2016-02-27 20:04:57 -08:00
ridiculousfish
211d626152 Remove unused MESS_SIZE define 2016-02-27 19:46:28 -08:00
ridiculousfish
e8aab9183e Remove some unnecessary statics and a silly #define const 2016-02-27 19:45:43 -08:00
ridiculousfish
10f3ea0008 Mark a bunch of constructors as explicit
This prevents undesired implicit conversions
2016-02-27 19:38:15 -08:00
ridiculousfish
88a785e321 Make expand_argument_list a static function
It doesn't use any properties of parser_t
2016-02-27 18:40:54 -08:00
ridiculousfish
d628fe0dea Eliminate parser_t::show_errors
Errors are now unconditionally shown
2016-02-27 18:37:59 -08:00
ridiculousfish
cbd3fa6b01 Eliminate parser_type_t
It was never fully implemented and wasn't used for anything
2016-02-27 18:25:58 -08:00
ridiculousfish
584cca59bf Allow -w option as short for --wraps in define_function
Fixes #2772
2016-02-27 17:47:23 -08:00
ridiculousfish
6cb48c6380 Allow variable completion from just a $
Previously there had to be some variable text, now you can
tab complete from just a naked $.
2016-02-27 16:51:44 -08:00
ridiculousfish
99be3ee96f Save a few allocations in src/parse_execution.cpp 2016-02-27 16:51:32 -08:00
ridiculousfish
c1c35e0f21 Fix a subtle problem that caused lots of unnecessary memory allocation 2016-02-27 16:51:28 -08:00
Aaron Gyes
c79ade9627 Send BEL to terminal to flash/beep while trying to complete something not completeable. 2016-02-25 08:18:27 +08:00
ridiculousfish
6c401bc587 Resume sorting completions from wildcard expansions
Ought to fix the wildcard expansion test on Linux
2016-02-22 03:37:39 -08:00
ridiculousfish
35160db268 Remove an unused variable 2016-02-22 03:37:03 -08:00
Michael Steed
5b0996fd80 make fish compatible with pcre2 10.21
pcre2_substitute() now sets the output buffer length to PCRE2_UNSET (~0)
if the output buffer is determined to be too small. This change keeps
track of the buffer size separately where pcre2 can't touch it.

A better fix would be to let pcre2 tell fish what size buffer it needs.
This can be done with PCRE2_SUBSTITUTE_OVERFLOW_LENGTH, but this
requires pcre2 10.21 or later (released January 12), which may be too
new to introduce as a dependency at this point.

Fixes #2743
2016-02-21 19:32:08 -08:00
ridiculousfish
947f659f96 Miscellaneous cleanup and dead code removal
Noticed by cppcheck
2016-02-19 15:45:31 -08:00
ridiculousfish
43e1c0a2bf Remove some newly dead code
out_suggested_cdpath is no longer required from is_potential_path
2016-02-18 17:00:26 -08:00
ridiculousfish
99e18d9cef Remove autosuggest_suggest_special 2016-02-18 17:00:26 -08:00
ridiculousfish
718d9baead Implement the cd "unique hierarchy" autosuggestion in expand.cpp 2016-02-18 17:00:26 -08:00
ridiculousfish
e2f4584220 Teach tests about changes to special autosuggestions 2016-02-18 17:00:26 -08:00
ridiculousfish
4138073a2f Always env_set_pwd after chdir in the fish tests
This avoids confusion between getcwd() and $PWD
2016-02-18 17:00:26 -08:00
ridiculousfish
1907323afc Additional work on unifying cd autosuggestions with complete 2016-02-18 17:00:26 -08:00
ridiculousfish
c39b94949b Complete to take a pointer to output completions, not a mutable ref 2016-02-18 17:00:26 -08:00
ridiculousfish
31bc88d16f Migrate sort_and_prioritize to complete.cpp 2016-02-18 17:00:26 -08:00
ridiculousfish
5dbf40ca75 Switch autosuggest_suggest_special to returning a completion_t 2016-02-18 17:00:26 -08:00
ridiculousfish
2d68b25025 Early work towards moving the cd special autosuggestion into completions
This will simplify some code and make the cd autosuggestion smarter
2016-02-18 17:00:25 -08:00
Aaron Gyes
0395c33982 Stop always returning STATUS_BUILTIN_ERROR on --merge. 2016-02-16 12:06:50 -08:00
ridiculousfish
81cdceddd3 Remove a debug() guarded by a surprising get_is_interactive
get_is_interactive can crash if proc_init has not been called.

Fixes #2280
2016-02-16 01:51:27 -08:00
ridiculousfish
5b506499c1 Use contains instead of string ==
Fix a few typos too
2016-02-15 13:27:00 -08:00
Andreas Nordal
62b76b26b4 Reinstate failglob behaviour for most commands
Expand globs to zero arguments (nullglob) only for set, for and count.

The warning about failing globs, and setting the accompanying $status,
now happens regardless of mode, interactive or not.

It is assumed that the above commands are the common cases where
nullglob behaviour is desirable.
More importantly, doing this with `set` is a real feature enabler,
since the resulting empty array can be passed on to any command.

The previous behaviour was actually all nullglob (since commit
cab115c8b9), but this was undocumented;
the failglob warning was still printed in interactive mode,
and the documentation was bragging about failglob behaviour.
2016-02-15 13:13:28 -08:00
ridiculousfish
3345f5d0d0 Remove an unnecessary typecast 2016-02-10 11:38:05 -08:00
ridiculousfish
28837a8b30 Remove a stale comment about const 2016-02-10 11:37:26 -08:00
Jon Eyolfson
96e688ea91 Remove const from _wgetopt_internal's argv argument
The argv argument may be modified on calls to exchange within the function and should not be const qualified (it's not true from the caller's point of view).
2016-02-10 11:35:47 -08:00
Andy Lutomirski
bc9e3c7546 fish_tests: Explicitly cast -2 to wchar_t
On arm, wchar_t is unsigned, and C++11 and newer disallow implicit
narrowing conversions inside braces.  Use an explicit conversion to
fix the build on GCC 6 and up, which defaults to C++11.
2016-02-08 13:48:28 -08:00
ridiculousfish
c4d0612e5c Factor expand_string into multiple stages
Breaks up a big ugly function into separable stages
with a common interface.
2016-02-05 01:22:46 -08:00
ridiculousfish
992dfcc4ce expand_string to return an enum instead of int 2016-02-05 00:00:38 -08:00
ridiculousfish
1e6492ef93 Bits of cleanup of expand_string
Remove some unnecessary variables, make some things not pointers
2016-02-04 23:57:21 -08:00
ridiculousfish
25ad8866c9 Merge change for lengthened and configurable escape key timeout 2016-02-04 13:56:49 -08:00
Kurtis Rader
2646d51a0b change default escape timeout
This changes the default escape timeout for the default keybindings (emacs
mode) to 300ms and the default for vi keybindings to 10ms.

I couldn't resist fixing a few nits in the fish_vi_key_bindings.fish file
since I was touching it to set the escape timeout.
2016-02-04 13:39:19 -08:00
Kurtis Rader
1d446b74ff when sourcing config.fish do not redirect stderr
All versions of fish prior to this change silently discarded anything written
to stderr while source a config.fish file. Apparently just to avoid having
the source command display an error if the file did not exist. This can mask
real problems. So instead this change explicitly checks whether the file is
readable and silently skips sourcing it if it isn't.

Resolves issue #2702.
2016-02-04 12:52:50 -08:00
ridiculousfish
dae0f63e5b Prefer special autosuggestions to match case
Fixes #2672
2016-02-04 12:46:52 -08:00
ridiculousfish
0779c89a65 Autosuggestions to follow same prioritization as tab completions
Partial fix for #2672
2016-02-04 12:46:51 -08:00
ridiculousfish
df8c4ce835 Use vector instead of deque in input_function_push_args
deque is a memory hog last I checked
2016-02-02 18:13:40 -08:00
ridiculousfish
b4a44deb7b Merge branch 'fix-jump' of git://github.com/cpick/fish-shell into cpick-fix-jump 2016-02-02 17:00:27 -08:00
ridiculousfish
60a477a303 Don't crash when autosuggesting cd'ing into a directory with ~
Fixes #2696
2016-02-02 16:47:39 -08:00
ridiculousfish
f8da754884 Work around some bogus static analyzer warnings 2016-02-02 15:39:46 -08:00
Kurtis Rader
4b9fece9f4 allow configuring the escape delay timeout
Introduce a "fish_escape_delay_ms" variable to allow the user to configure the
delay used when seeing a bare escape before assuming no other characters will
be received that might match a bound character sequence. This is primarily
useful for vi mode so that a bare escape character (i.e., keystroke) can
switch to vi "insert" to "normal" mode in a timely fashion.
2016-01-17 17:45:30 -08:00
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