Commit graph

6107 commits

Author SHA1 Message Date
Aaron Gyes
43515e1298 Use command -v instead of which in _.fish
I didn't know that there was any which usage outside of type -a
in our functions, until I grepped and noticed this.
2016-08-07 15:23:51 -07:00
Jin Liu
ccd62ff44b Bug fix: fish_config/bindings display ESC as "ALT-e"
Fixes #3286
2016-08-04 12:39:32 -07:00
Fabian Homborg
744da2cab2 Add backspace bindings to vi-mode
This was erroneously omitted from the previous commit.

Now backspace in insert mode does backward-delete-char, in default mode
backward-char (i.e. no deleting, just moving). This is consistent with vim.
2016-08-04 20:45:21 +02:00
Fabian Homborg
b36414152b Add binding sharing to changelog 2016-08-04 15:05:13 +02:00
Fabian Homborg
93b9e7443e Share some bindings between vi- and emacs-mode
This undoes the inheritance since it shared too much.

The idea here is to share bindings that aren't something the editors we're inspired by do - there's no "execute" in vi.
The basic editing and moving bindings are now vi-style in vi-mode and emacs-style in default mode.
2016-08-04 14:03:13 +02:00
Hunsu
b1f576deae Add completions for Arcanist (#3256) 2016-08-03 15:08:22 +02:00
Aaron Gyes
01f09cf4c1 Make fish build more quietly. Merge PR #3248 floam/shutupmake
Makefile now omits most build output by default.

`make V=1`  for verbose output
2016-08-02 16:41:41 -07:00
Fabian Homborg
d68320a3c6 Enable 24bit mode less often
In particular, Screen and emacs' "ansi-term" behave like neovim in that
they just ignore the sequences, which leads to the terminal rendering
default color (most of the time white) instead.
2016-08-03 01:13:31 +02:00
[Redacted]
00cb9ce80a Add git shortlog completion (#3274) 2016-08-02 19:34:28 +02:00
Fabian Homborg
afa266a7ea git completions: Fix cases without current branch
Sometimes git just isn't on a branch.
2016-08-02 00:12:31 +02:00
Aaron Gyes
3f9bd72bca Revert "add files for the fish logo as used for the fish-shell stickers"
This reverts commit c4cc9f9b8d.

See #3278
2016-08-01 16:30:14 -04:00
Aaron Gyes
fb845cdb72 comments, diff hunk smarts in .gitattributes
Fix up some redundant paths as well.
2016-08-01 07:05:24 -07:00
Aaron Gyes
8277f6a1ba Let git normalize line-endings upon commit (LF)
Only one file belonging to fish-shell had DOS/bogus line endings,
with `git add' picking up changes after updating .gitattributes:
hostname.fish.

Unsurprisingly, it has code to support cygwin and was likely
worked on by a user on a Windows machine. This will help
such cases in the future.

Also, in pcre2-10.21/, there was RunTest.bat which was (correctly)
CRLF formatted.  We don't use this batch script at all, so rather
than LF it or add an exception, blast it away like the other pcre2
files omitted from the repo.
2016-08-01 04:38:08 -07:00
Aaron Gyes
d7604dcc99 Control Makefile verbosity level with V=.
Instead of using @ directly most of the time, use $(v) which can be
'' or @ controlled by V. Defaults to 0. make V=1 for a verbose make.
2016-07-31 12:25:27 -07:00
Aaron Gyes
71e1e38426 Silence the Makefile build
There was a lot of very noisy output for things
we do not care about, particularly the echoing of clang commands,
installs, and doxygen output.

We now show output like " CXX     src/fish.o" and not much else
unless there is a problem.

Add mechanism to show e.g. CXXFLAGS variables at top of build.

Improve make docs output

Highlight FISH_BUILD_VERSION

FISH_BUILD_VERSION is yellow.
Run ./configure with -q
2016-07-31 12:24:35 -07:00
Aaron Gyes
b77e2a67f8 Only do fish_greeting if interactive
Even if __fish_config_interactive, it can be shown when a script
uses `read`.

Fixes #3261, #1401.
2016-07-30 22:47:17 -07:00
Aaron Gyes
e75fc8452f Strip out brackets from generated-by-manpage completions.
Handles cases like cupsctl --\[no-\]remote-admin and
unxz --powerpc[ better.

Fixes #3272
2016-07-30 22:01:59 -07:00
Kurtis Rader
6c8ecab44b fix copy/paste bug in moving a block of code 2016-07-30 19:59:34 -07:00
Kurtis Rader
5da3d2f27b revert part of earlier "cleanup" change
Commit acfd3801 included a legitimate bug fix and a second change that
didn't correct an actual bug but made the code more fragile. Revert the
second part of that commit (while also suppressing the uninitialized
variable compiler warning that caused the ill-advised change).
2016-07-30 19:32:05 -07:00
Aaron Gyes
d51a1e4fe2 kill CAST_INIT, use reinterpret_cast<> on sockaddr
Just use static_cast directly instead of inscrutible "shortcut"
macro.

It was not always used and doesn't seem to do much besides scramble
things up; encountering CAST_INIT() in the code seems likely to lead
to head scratching due to the transformation taking place.

It was added to save folks typing the type twice, now with 100
columns available, let's roll that convenience macro back.

sockaddr_dl:

Perform reinterpret_cast<sockaddr_dl> conversion. The cast affected
alignment and looks fishy to a compiler (but it's fine). Ditch
C-style cast and communicate we're doing that on purpose.
2016-07-30 13:10:25 -07:00
Aaron Gyes
ee26eafc25 Ensure we continue to cover enums in switches
Where we already manage to cover an enum entirely in a switch
statement such that default: cannot be reached, help ensure
it stays that way by condemning that route.

Also adjust a 'const' I came across that is ignored.
2016-07-30 13:10:21 -07:00
Aaron Gyes
acfd380176 Fix two things -Wconditional-uninitialized warned about
Rather minor stuff:
* Initliaze first case to 0.
* The other (saved_errno), move the error output it is for
  in-scope and not need at all.
2016-07-30 03:34:46 -07:00
Kurtis Rader
3a08a24259 remove diagnostic no one likes 2016-07-28 16:15:58 -07:00
Fabian Homborg
0a51b17716 if started without a locale read system config
A common problem for users is that fish doesn't get a locale. This often
happens if systemd is used with getty and fish as login shell.

Fixes #277

Note that I (@krader) made editorial changes before merging this. For
example, running `make style` and otherwise changing long statements to a
series of shorter statements. So if there are any problems it is possible
I introduced them.
2016-07-27 22:15:54 -07:00
Kurtis Rader
b12c413c28 add sources of 3rd-party extensions to the FAQ
Fixes #2103
2016-07-27 20:55:04 -07:00
Kurtis Rader
375de96016 deal with missing argv
A user reported that fish was dying from a SIGSEGV when launched by the
sjterm terminal app. This was traced to a bug in sjterm passing an empty
argv array to the shell. Which, while technically legal, is very unusual
and a bad practice.

Fixes #3269
2016-07-27 16:38:18 -07:00
Fabian Homborg
49008d7a1c Fix escaping in abbr --erase completions
Fixes #3267
2016-07-26 15:23:02 +02:00
ridiculousfish
e1ab6494cd Revert "Improve style script."
This change made clang-format apply to our JavaScript sources,
but we haven't yet agreed upon a JavaScript style guide. Once we
agree on one, we can include the JS files in the formatting pass too.

This reverts commit 799d8ddfc4.
2016-07-24 17:58:56 -07:00
Aaron Gyes
5afd939f3e Stop swallowing the cartesian product
This should work:
 > env TERM=vt100 ./fish -c 'echo (set_color red)"hi"'

We do a ::reset() if setting the color doesn't happen.

Fixes #2951
2016-07-24 17:56:34 -07:00
Aaron Gyes
644ea82c2f Update set_color documentation
Update docs for "brblack", "brwhite"  existing.

We no longer mention colors like grey, brown and purple, which are aliases
for yellow, magenta, white/black. The color names still work but there
isn't a good argument for there being two ways to do that: especially in
the age of 24-bit terminals where one might expect yellow and brown or
magenta and purple to actually be different colors.

Copyedit rest of document for inaccuracies, strange advice, brevity (a lot
of "you" pronouns, for example.)

Document the color fallback feature (set_color 313554 blue) that's been
present quite a while.
2016-07-24 17:50:13 -07:00
ridiculousfish
450d4be88f Shorten an overlong set_color example in the man page
The `set_color normal` text had a comment that caused
the example to wrap to the next line in an 80 column window.
Shorten the comment so the example fits on one line.
2016-07-24 17:04:51 -07:00
Aaron Gyes
3669805627 Improve compatibility with 0-16 color terminals.
Fish assumed that it could use tparm to emit escapes to set colors
as long as the color was under 16 or max_colors from terminfo was 256::

 if (idx < 16 || term256_support_is_native()) {
    // Use tparm to emit color escape
    writembs(tparm(todo, idx);

If a terminal has max_colors = 8, here is what happenened, except
inside fish:

 > env TERM=xterm tput setaf 7 | xxd
   00000000: 1b5b 3337 6d                             .[37m
 > env TERM=xterm tput setaf 9 | xxd
   00000000: 1b5b 3338 6d                             .[39m

The first escape is good, that second escape is not valid.
Bright colors should start at \e[90m:

 > env TERM=xterm-16color tput setaf 9 | xxd
   00000000: 1b5b 3931 6d                             .[91m

This is what caused "white" not to work in #3176 in Terminal.app, and
obviously isn't good for real low-color terminals either.

So we replace the term256_support_is_native(), which just checked if
max_colors is 256 or not, with a function that takes an argument and
checks terminfo for that to see if tparm can handle it. We only use this
test, because otherwise, tparm should be expected to output garbage:

 /// Returns true if we think tparm can handle outputting a color index
 static bool term_supports_color_natively(unsigned int c) { return max_colors >= c; }
...

 if (term_supports_color_natively(idx) {

And if terminfo can't do it, the "forced" escapes no longer use the fancy
format when handling colors under 16, as this is not going to be compatible with
low color terminals. The code before used:

 else {
     char buff[16] = "";
     snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);

I added an intermediate format for colors 0-15:

 else {
     // We are attempting to bypass the term here. Generate the ANSI escape sequence ourself.
     char buff[16] = "";
     if (idx < 16) {
         snprintf(buff, sizeof buff, "\x1b[%dm", ((idx > 7) ? 82 : 30) + idx + !is_fg * 10);
     } else {
         snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);
     }

Restores harmony to white, brwhite, brblack, black color names.
We don't want "white" to refer to color color #16, but to the
standard color #8. #16 is "brwhite".

Move comments from output.h to output.cpp

Nuke the config.fish set_color hack for linux VTs.

Sync up our various incomplete color lists and fix all color values.
Colors 0-8 are assumed to be brights - e.g. red was FF0000. Perplexing!

Using this table:
 <http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html>

Fixes #3176
2016-07-24 17:02:29 -07:00
ridiculousfish
46fba342db Revert "Only show greeting on interactive login sessions"
This reverts commit 3d0ea5fe79.
2016-07-24 16:39:44 -07:00
ridiculousfish
5eedb0ee9c Revert "Only show fish greeting for interactive logins"
This reverts commit 3a7a6f16ef.
2016-07-24 16:39:43 -07:00
ridiculousfish
325f047803 Revert "Update __fish_config_interactive.fish"
This reverts commit ec292ec51b.
2016-07-24 16:39:41 -07:00
ridiculousfish
c76f896f69 Revert "Revert "Only show greeting on interactive login sessions""
This reverts commit 88688d02b2.
2016-07-24 16:39:40 -07:00
Aaron Gyes
88688d02b2 Revert "Only show greeting on interactive login sessions"
This reverts commit 3d0ea5fe79.
2016-07-24 03:53:27 -07:00
Aaron Gyes
ec292ec51b Update __fish_config_interactive.fish 2016-07-24 01:42:58 -07:00
Aaron Gyes
3a7a6f16ef Only show fish greeting for interactive logins
This is a regression introduced by 834ebef53c
Bolster with a check for only login sessions too -- hopefully makes it
less annooying on subshells in general.

Fixes #3261
2016-07-24 00:05:05 -07:00
Aaron Gyes
3d0ea5fe79 Only show greeting on interactive login sessions
Fixes #3261
2016-07-23 23:33:20 -07:00
Aaron Gyes
d252704fdb checkout non-empty colorutils.js
The last commit was obviously an error!
2016-07-23 17:18:10 -07:00
Aaron Gyes
dfe363c945 clang-format colorutils.js
.... should make the #3260 diff shorter.
2016-07-23 17:03:32 -07:00
Aaron Gyes
799d8ddfc4 Improve style script.
clang-format supports javascript and our 1 obj-c file. Also,
let it pick up a handful of missed files of types we already inteded it
to fix up.

Improve formatting and output.
2016-07-23 05:02:27 -07:00
Scott Bonds
99351fcb44 Don't use getent to list hosts if its not supported (#3259)
Fixes #2137 on OpenBSD
2016-07-23 13:24:12 +02:00
Aaron Gyes
9bd5257dda Use h2s in PULL_REQUEST_TEMPLATE.md
The headers just appeared rather large and we can't control the stylesheet.
2016-07-22 18:19:57 -07:00
Kurtis Rader
10ae6d8b26 fix some style problems that have crept in 2016-07-21 19:36:32 -07:00
Aaron Gyes
2fa4bd8fd7 Add missing debug output for two cases. 2016-07-21 07:23:14 -07:00
Aaron Gyes
3468fbc605 Tighten up support_term256 logic. Add missing Apple_Terminal underscore
Add some debug output like there is for 24bit mode.

I see now there is no need to setup terminal here - we get called early
sometimes for colors to work in config.fish to work but that is not so fatal.
Just check cur_term and trust get called again soon.
2016-07-21 07:10:00 -07:00
Kurtis Rader
34ca8fd213 a couple more oclint RAII error suppressions 2016-07-20 23:05:08 -07:00
Kurtis Rader
8140f74d75 simplify oclint error suppression for scoped_buffer_t 2016-07-20 22:43:48 -07:00