Commit graph

6390 commits

Author SHA1 Message Date
Kurtis Rader
9443a415bf time for another make style-all 2016-12-03 20:12:53 -08:00
Kurtis Rader
45d3a705be fix bug introduced by commit eaa37413
When I refactored the code to reduce redundancy and improve the error
messages when the config or data directories could not be used I botched
the customization of the $HOME based data path.
2016-12-03 18:38:00 -08:00
Maciej Ostaszewski
4288db9d39 correct option for bc completion 2016-12-04 00:22:31 +01:00
ridiculousfish
8324893565 Update osx/config.h with HAVE_FLOCK macro
flock() is available on OS X
2016-12-03 13:46:10 -08:00
ridiculousfish
41d4058156 Merge branch 'cleanup_pager'
Fixes those ugly compiler warnings in the pager
2016-12-03 13:41:30 -08:00
ridiculousfish
ed85393611 Restyle pager.cpp via make style 2016-12-03 13:38:50 -08:00
ridiculousfish
ffd4754cb2 Don't show the pager on terminals of height less than 4
Prevents some potential overflow bugs and janky UI
2016-12-03 13:35:24 -08:00
ridiculousfish
54dd4b7ed6 Untangle some pager code and fix some warnings
Fixes various warnings about implicit conversions
2016-12-03 13:29:16 -08:00
ridiculousfish
8041913e7a Stop including spacer width in width_by_column in pager
Additional refactoring to remove some sketchy-looking arithmetic
2016-12-03 13:29:16 -08:00
ridiculousfish
2d5ce72cb4 Remove the min_width parts of the pager
min_width dates back to the original full-screen pager.
After some careful inspection, the code path that uses min_width
is never executed and so the min_width machinery is useless.
Let's remove it!
2016-12-03 13:29:16 -08:00
ridiculousfish
d058d290be Factor pref_width into a function preferred_width()
Beginnings of some pager cleanup
2016-12-03 13:29:16 -08:00
ridiculousfish
85d697f13d Add some pager layout test cases
Helps ensure correct truncation logic
2016-12-03 13:29:16 -08:00
ridiculousfish
754b78a748 Suppress certain stderr-printing during tests
Tests that exercise error paths may result in output to
stderr. This may make it look like the test failed when it did
not. Introduce should_suppress_stderr_for_tests() to suppress
this output so the test output looks clean.
2016-12-03 13:27:50 -08:00
Radomír Bosák
254762f30f Fix status code when bad command name is entered
This commit fixes a bug which causes that

   fish -c ')'; echo $status

("Illegal command name" error) returns 0. This is inconsistent with
e.g. when trying to run non-existent command:

   fish -c 'invalid-command'; echo $status

("Unknown command" error) which correctly returns 127.

A new status code,

    STATUS_ILLEGAL_CMD = 123

is introduced - which is returned whenever the 'Illegal command name *'
message is printed.

This commit also adds a test which checks if valid commands return 0,
while commands with illegal name return status code 123.

Fixes #3606.
2016-12-03 13:14:40 -08:00
David Adam
bf53f39cdd cppcheck: warn on use of flock 2016-12-03 16:36:06 +08:00
David Adam
2b0bad889a configure: force use of -pthread on Solaris
This fixes a problem with non-threadsafe errno.

Ideally, this would be the use of the AX_PTHREAD macro, but it is GPL 3+
only, which is incompatible with the GPL 2 license of fish. It also
would need extending to cover C++.

For now, fish doesn't build on anything except GCC under Solaris anyway,
so `-pthread` is the right thing to use.

Work on #3340.
2016-12-03 16:36:06 +08:00
David Adam
ee15f1b987 configure: check that errno is threadsafe
Without `-pthread` specified to the compiler, errno is not threadsafe on
Solaris (as _REENTRANT is undefined, and _POSIX_C_SOURCE may not be set
until after the inclusion of <errno.h>).

Work on #3340.
2016-12-03 16:36:06 +08:00
David Adam
3289797248 flock fallback: remove noop path
"fail to no locking" is not an ideal strategy.
2016-12-03 16:36:06 +08:00
David Adam
2b7dddf342 add flock fallback
Import the flock compatibility wrapper from NetBSD.

Work on #3340.
2016-12-03 16:36:06 +08:00
David Adam
1293cd8b6a Check for functions in std namespace
On Solaris, some standard wide character functions are only contained in
the std:: namespace. The configure script now checks for these, enabling
the appropriate `uses` statements in src/common.h.

The checks are handwritten, because Autoconf's AC_CHECK_FUNC macro
always uses C linkage, but the problem only appears under C++ linkage.

Work on #3340.
2016-12-03 16:36:06 +08:00
David Adam
417255fc55 Makefile: skip the open manpage on OS X
This is normally handled by the build_documentation.sh script, but if
the tarball includes the documentation then that script is never run.

We should do it in both places as the Xcode build uses only the
build_documentation.sh script!

Fixes #2561.
2016-12-03 12:44:35 +08:00
Kurtis Rader
d73ff39393 fish vi mode cursor shape on iTerm2
Fixes #3593
2016-12-02 19:49:15 -08:00
ridiculousfish
227ba10628 Add -Wno-unreachable-code to PCRE in Xcode build
Prevents an annoying warning from the PCRE build
in Xcode
2016-12-02 15:48:18 -08:00
David Adam
15921d37c4 debian packaging: avoid autoreconf on old platforms
The autoreconf step requires a newer version of automake than is
available on older versions of Debian and Ubuntu; avoid the autoreconf
step on these platforms for now.
2016-12-02 15:40:20 +08:00
Kurtis Rader
eaa3741336 improve error msg about invalid HOME/XDG_* var
This change increases the amount of useful information when fish is
unable to create or use its config or data directory. We now make it
clear when neither var is set or one is set to an unusable location.

Fixes #3545
2016-12-01 20:40:25 -08:00
Fabian Homborg
422ff0f173 Don't paste if xsel fails
This silences a rather verbose error.
2016-12-02 01:29:58 +01:00
Michael Steinert
e2ed561264 Fixes behavior of 'x' in normal mode
After 'x' is used to delete a character at the end of a line the cursor
should be repositioned at the last character, i.e. repeatedly pressing
'x' in normal mode should delete the entire string.
2016-12-01 16:23:59 -08:00
Radomír Bosák
1fbcb1ee9d Add the possibility to rename abbreviations
The abbr function doesn't have the possiblity to rename abbreviations.
You have to delete the old one and create a new one. This commit adds
this functionality and uses the syntax:

abbr -r OLD_KEY NEW_KEY

Fixes #2155.
2016-12-01 14:42:20 -08:00
David Adam
a0d9db94cb osx/config.h: update to match current configure output 2016-11-30 18:50:23 +08:00
Aaron Gyes
6a5a1a8964 [[noreturn]] instead of __attribute__ ((noreturn))
C++11 does this, better to use a standard attribute than a compiler
extension.
2016-11-29 01:41:03 -08:00
Aaron Gyes
a8b2da8405 Use early returns throughout builtin_cd and fix my no-HOME output. 2016-11-28 23:59:37 -08:00
Kurtis Rader
7cfe028b9d fix functions --copy
Fixes #3601
2016-11-28 18:04:37 -08:00
Kurtis Rader
1ca1667786 fix bug introduced by fish_indent
Commit 11a60c8 restyled all the fish scripts using fish_indent. Sadly a
bug in fish_indent did not correctly reformat an unusual structure.
2016-11-28 17:13:01 -08:00
Kurtis Rader
c8d2e6d972 two more tests of VTE_VERSION that need protection 2016-11-28 14:39:41 -08:00
David B. Lamkins
ca33bbd4e0 Eliminate spurious startup message when $VTE_VERSION is unset. 2016-11-28 14:36:20 -08:00
Aaron Gyes
f47ebc4b1c builtin cd: Handle unset HOME. 2016-11-28 12:40:55 -08:00
Aaron Gyes
682af2f83f Remove 4 cppcheck suppressions reported unmatched. 2016-11-28 11:54:03 -08:00
Aaron Gyes
7c6527e9cf Fix segfault with bad USER and unset HOME
A couple things went wrong with `env -u HOME USER=x ./fish -c ''`
We failed to check that `pw` isn't NULL leading to a crash when USER is
bogus. After fixing that we were not left with both variables in a
correct state still.

We now go back and force fish to dig up a working USER when we notice
this and then get both set successfully. Fixes #3599
2016-11-28 09:34:56 -08:00
Aaron Gyes
121109ee4d Adds a --quiet/-q option for command -s (#3591)
devnull'ing this builtin to check presence is a common
enough chore that a --quiet option which works like it does on
`type` would be handy.
2016-11-28 07:26:01 -08:00
Kurtis Rader
11a60c8374 reformat all fish scripts
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
2016-11-27 21:27:22 -08:00
Kurtis Rader
54a76bb9e5 emit error message when test is given invalid int
This augments the previous change for issue #3346 by adding an error
message when an invalid integer is seen. This change is likely to be
controversial so I'm not going to squash it into the previous change.
2016-11-27 20:37:30 -08:00
Kurtis Rader
2f33c24a07 fix handling of odd strings by test builtin
The `test` builtin currently has unexpected behavior with respect to
expressions such as `'' -eq 0`. That currently evaluates to true with a
return status of zero. This change addresses that oddity while also
ensuring that other unusual strings (e.g., numbers with leading and
trailing whitespace) are handled consistently.

Fixes #3346
2016-11-27 20:37:21 -08:00
Aaron Gyes
d0146d7b6f builtin test: output correct program name on error
Only in one instance would test as `[` have the the errors formatted
as "[: foo". This fixes that. When trying to track down the source of
an error this could lead someone astray.
2016-11-27 20:28:38 -08:00
Fabian Homborg
9ad1b86e4e Reset bindings if the new value was bogus.
See #3590.
2016-11-27 14:17:24 +01:00
Aaron Gyes
f63c8a703e 'test' completions: comment out entries
Our builtin doesn't do some of this stuff. See #3589
2016-11-27 03:05:11 -08:00
Aaron Gyes
4f6ac06b21 Don't automatically generate completions without python
This is doomed to cause a messy error on every launch on any systems
that are using fish without python installed. Fixes #3588
2016-11-27 02:00:21 -08:00
Aaron Gyes
18cc06b38f Don't no-op terminal.app title if it's customized
We only want to override the internal fish hardcoded title.
Fixes #3578
2016-11-26 20:02:51 -08:00
ridiculousfish
c1d4c07548 Update Xcode project for Xcode 8.1 2016-11-26 16:25:55 -08:00
ridiculousfish
e97c5b552c Update make_tarball.sh to run autoreconf instead of autoconf
This is necessary as part of the autotools build changes
for C++11
2016-11-26 15:02:19 -08:00
ridiculousfish
9588c9a811 Teach make distclean to delete autom4te.cache aclocal.m4 2016-11-26 14:58:31 -08:00