Commit Graph

7529 Commits

Author SHA1 Message Date
ridiculousfish
a5fd0b317e Revert "Switch to bare vars in our math invocations"
This reverts commit bd18736ee5.

Bare variables should only be used in commands that must
manipulate the variable stack, such as `set`.
2017-09-09 23:35:47 -07:00
ridiculousfish
c2a5e7ae27 Revert "Remove workaround for long-since-fixed neovim 24-bit bug"
This reverts commit bb419d4f5e.
2017-09-09 23:28:27 -07:00
Mahmoud Al-Qudsi
bb419d4f5e Remove workaround for long-since-fixed neovim 24-bit bug
Closes #2792 and addresses the (closed) #2768
Tested against neovim 0.2.1-dev
2017-09-09 23:59:40 -05:00
Mahmoud Al-Qudsi
bca17db96e Preserve git's own ordering of branch/tag completions for checkout
Addresses the main concern of #3830 by preserving the internal ordering
of tag/branch listings generated by git. Fixes mixing of remote and
local branches in completions.

Does not address the concern of having local branches on top, remote
branches after, and tags at the bottom - I don't believe we have that
functionality available to us yet. #361 only implemented sort within a
category of completions, but there is no category "weight" unless I'm
mistaken.
2017-09-09 23:35:04 -05:00
Mahmoud Al-Qudsi
55b3c45f95 No longer put fish in own process group on startup
As discussed in #3805, this patch disables assigning fish to its own
process group at startup. This was trialled in #4349 alongside other
pgrp fixes which introduced additional problems, but this particular fix
seems to be OK.

Fixes #3805 and works around Microsoft/BashOnWindows#1653
2017-09-09 22:32:16 -05:00
Kurtis Rader
ee226eeccd Fix incorrect recommendations by IWYU on macOS 2017-09-09 00:18:05 -07:00
Kurtis Rader
83b1b5d282 Tell oclint to ignore another idiom that is safe 2017-09-09 00:18:05 -07:00
ridiculousfish
b142262cf7 Update the Xcode build
Add missing muParser dependencies and link steps.

Fixes #4379
2017-09-08 21:37:29 -07:00
Kurtis Rader
905766fca2 Hoist for loop control var to enclosing scope (#4376)
* Hoist `for` loop control var to enclosing scope

It should be possible to reference the last value assigned to a `for`
loop control var when the loop terminates. This makes it easier to detect
if we broke out of the loop among other things.  This change makes fish
`for` loops behave like most other shells.

Fixes #1935

* Remove redundant line
2017-09-08 21:14:26 -07:00
Fabian Homborg
527e102746 Fix string match -en error typo
Fixes #4386.
2017-09-08 16:33:34 +02:00
Fabian Homborg
9347951158 Clarify string match without -r partial match
Fixes #4388.
2017-09-08 16:33:34 +02:00
Fabian Homborg
b00daebec2 __fish_print_hostnames: Use string replace -f
Saves one `string match` invocation.

Also removes a useless-use-of-cat.

(cherry picked from commit 4437e8d8d6)
2017-09-07 16:30:17 +02:00
Moritz
6145b4a770 Add completions for git checkout --ours/--theirs (#4380)
* Add completions for git checkout --ours/--theirs

* Change description for `git checkout --ours/--theirs´ completions
2017-09-07 16:24:05 +02:00
Fabian Homborg
c2f0a45d60 git completions: Use modified files in the index for reset
Fixes #4329.
2017-09-06 10:25:58 +02:00
Marcel Bischoff
c0c33b3605 Add basic ezjail-admin completion 2017-09-06 09:55:14 +02:00
Sam Yu
81becc5f6b Add repo completion for zypper (#4325)
* Add repo completion for zypper

* Replace sed with string in __fish_print_zypp_repos

* Move function into completion script

* Update zypper completion

add subcommand packages to __fish_zypper_repo_commands
2017-09-06 09:53:49 +02:00
Fabian Homborg
76609de4da pacman-ish completions: Complete files for -Qo and -Qp
These were explicitly suppressed, which was wrong.

(cherry picked from commit 908063d830)
2017-09-05 16:56:47 +02:00
ridiculousfish
cb352317bd Simplify the cached_esc_sequences_t structure
The type cached_esc_sequences_t caches escape sequences, and is tasked
with finding an escape sequence that prefixes a given string. Before
this fix, it did so by storing the lengths of cached escape sequences,
and searching for substrings of that length. The new implementation
instead stores all cached escape sequences in a sorted vector, and uses
binary search to find the shortest escape sequence that is a prefix of
the input. This is a substantial simplification that also reduces
allocations.
2017-09-01 14:36:16 -07:00
David Adam
91a0ba9be5 Revert part of "Revert "Cache math expressions""
56d9134534 contained an LRU cache plus
changes to the documentation; 95162ef19d
reverted both.

This commit re-adds the documentation changes, which are still correct.
2017-09-01 21:55:50 +08:00
ridiculousfish
95162ef19d Revert "Cache math expressions"
This reverts commit 56d9134534.

An LRU cache in the shell for math seems like overkill.
2017-09-01 00:25:40 -07:00
ridiculousfish
3d40292c00 Switch env_var to using maybe_t
This eliminates the "missing" notion of env_var_t. Instead
env_get returns a maybe_t<env_var_t>, which forces callers to
handle the possibility that the variable is missing.
2017-09-01 00:14:42 -07:00
ridiculousfish
18203a081c Add maybe_t template class
maybe_t is an implementation of the Maybe/Optional type, allowing
for an optional value to be stored. This will enable a more
principled approach for functions that return values or failure,
such as env_get.
2017-09-01 00:14:14 -07:00
Benjamin Reitzammer
72244dee5b add --force-with-lease completion for git push (#4368) 2017-08-30 19:59:49 -07:00
ridiculousfish
c8cf8a6669 Clean up fish_uvars_test directory in tests
Allows running fish_tests directly without an initialization phase.
2017-08-30 01:02:18 -07:00
ridiculousfish
4baada25b9 Use move semantics instead of swap in env_set
This commit backs out certain optimizations around setting environment
variables, and replaces them with move semantics. env_set accepts a
list,  by value, permitting callers to use std::move to transfer
ownership.
2017-08-30 00:59:45 -07:00
Alexey Alekhin
75dd852340 Added sbt to the list of new completions
Also fixed sublist indentation and removed periods for formtatting consistency
2017-08-30 00:12:20 -07:00
modula t. worm
fa3ca4dc3d Add completions for kdeconnect-cli (KDE Connect) 2017-08-30 00:07:07 -07:00
Alexey Alekhin
a43da0163a Added sbt completions 2017-08-29 23:57:21 -07:00
daniel-surename
ed475ab24b fix: git status in __fish_git_prompt_informative_status (#4365)
Added and staged files weren't shown in the prompt,
had a missing $ to denote variables
2017-08-29 23:50:27 -07:00
David Adam
874a675e7f builtin_read: pickup MB_CUR_MAX from stdlib not xlocale
Fixes building on OpenBSD; work on #4184.
2017-08-28 01:44:07 +08:00
David Adam
6b7bcdbc91 .gitignore: ignore more muParser artefacts 2017-08-27 21:44:51 +08:00
ridiculousfish
d62a6cf28d Fix the Xcode build
This adds muParser support to the Xcode build.
2017-08-26 23:29:15 -07:00
Mahmoud Al-Qudsi
dfeac760b9 Fix invalid memory access regression
Commit f872f25f introduced a freed memory access regression on line 460
of env.cpp, where an environment variable was converted to a temporary
string, the .c_str() address of which was stored while the string
temporary was destroyed.

This commit keeps a reference to the original string lying around so
that the c_str() pointer does not point to freed memory.
2017-08-26 19:24:05 -05:00
Mahmoud Al-Qudsi
e656654456 Fix uninitialized sigaction.sa_flags valgrind error
Valgrind warns that the sometimes uninitialized sigaction.sa_flags field
is sometimes used when passed to the signal handler.

This patch explicitly zeros out the sigaction.sa_flags field at creation
time.
2017-08-26 19:13:58 -05:00
Kurtis Rader
99d2a344c7 Fix indexing of $history
cherry-picked from krader1961/fish-shell commit b69df4fe72

Fixes #4353 (regression in indexing of history contents) and introduces
new unit tests to catch bad $history indexing in the future.
2017-08-25 20:28:45 -05:00
David Adam
1872fb4ea9 fish.spec: depend on system pcre2 libraries where available 2017-08-26 00:16:29 +08:00
David Adam
1590bd15f1 MuParser: restore build system
Restores the build files mistakenly dropped in 86b1c5a5a4.
2017-08-25 09:04:50 +08:00
David Adam
99ad68fc72 .gitignore: tighten ignore patterns
Avoids false positives for build subdirectory in muParser source
2017-08-25 09:04:18 +08:00
David Adam
456b51a50e .gitignore: adjust build system artefacts
Keep the configure files in our vendored directories
Drop some other build system artefacts in these directories
2017-08-25 07:54:40 +08:00
David Adam
86b1c5a5a4 Update MuParser source
Drop build system artefacts and move to versioned directory.

Tarball from
https://github.com/beltoforion/muparser/archive/v2.2.5.tar.gz with
samples/example2 directory removed.
2017-08-25 07:54:40 +08:00
Kurtis Rader
bd18736ee5 Switch to bare vars in our math invocations
Using bare vars is more efficient because it makes the builtin `math`
expression cache more useful. That's because if you prefix each var with
a dollar-sign then the fish parser expands it before `math` is run.
Something like `math x + 1` can be cached since the expression is the
same each time it is run. But if you do `math $x + 1` and x==1 then you're
effectively executing `math 1 + 1`. And if x==2 the next time then you're
running `math 2 + 1`. Which makes the expression cache much less effective.
2017-08-24 12:38:10 -07:00
Kurtis Rader
56d9134534 Cache math expressions
This implements an LRU cache of recently seen math expressions. When
executing math inside loops and the like this can provide a 33% decrease
in the time to execute the `math` command.
2017-08-24 12:18:39 -07:00
Kurtis Rader
8fe1108cec Update changelog to mention math builtin 2017-08-24 10:26:46 -07:00
David Adam
6cff72b226 CONTRIBUTING.md: add note about dependencies 2017-08-24 22:55:32 +08:00
David Adam
1183505695 README.md: rearrange and rewrite
Closes #2062
2017-08-24 22:55:16 +08:00
Kurtis Rader
c95b9f06e1 Implement support for bare vars by math
This change allows you to type `math x + 3` rather than `math $x + 3`.

Another step to resolving issue #3157.
2017-08-23 20:41:45 -07:00
Kurtis Rader
d10decabda Make builtin math the default implementation
Remove our `math` function that wraps `bc`. Our math builtin is now good
enough that it can be the default implementation.

Another step in resolving #3157.
2017-08-23 17:32:49 -07:00
Kurtis Rader
b816cd6d50 Change how math rounds integer results
We need our `math` builtin to behave like `bc` with respect to rounding
floating point values to integer to avoid breaking to many existing
uses. So when scale is zero round down to the nearest integer.

Another change for #3157.
2017-08-23 17:31:04 -07:00
Kurtis Rader
24d251ff4b Implement support for multiple math expressions
The MuParser supports the concept of multiple expressions separated by
commas. This implements support for that so that you can do things like
this:

    set results (math '1+1, 4*2, 9^2')
2017-08-23 17:14:54 -07:00
Kurtis Rader
41a7b9457c Implement bare minimum builtin math command
This is the second baby step in resolving #3157. Implement a bare minimum
builtin `math` command. This is solely to ensure that fish can be built
and run in the Travis build environments. This is okay since anyone running
`builtin math` today is already getting an error response.

Also, more work is needed to support bare var references, multiple result
values, etc.
2017-08-23 14:43:45 -07:00