Commit Graph

4146 Commits

Author SHA1 Message Date
ridiculousfish
e9f870e25a Add support for history --merge to incorporate history changes from
other sessions.

Fixes #825
2014-07-25 10:49:12 -07:00
Siteshwar Vashisht
317660c2fe Avoid using OptionParser to parse bindings in webconfig.py
OptionParser eats commaandline arguments passed to bind actions, so avoid using it.
2014-07-25 08:39:31 +05:30
ridiculousfish
5e60efefbf Allow parse_util_detect_errors to treat incomplete strings as errors
Fixes bug where sourcing a file with an unclosed quote would not have a
backtrace
2014-07-24 14:41:15 -07:00
ridiculousfish
f6a89d13c2 Merge branch 'master' of github.com:fish-shell/fish-shell 2014-07-23 22:27:37 -07:00
Siteshwar Vashisht
3e01dd955f Updated code to parse bindings in webconfig.py 2014-07-23 01:53:15 +05:30
adisbladis
27fa0ea9d7 "webconfig.py: Don't allow NoneType as buffer, fallback to bytes.
Fixes TypeErrors when using bindings tab"
2014-07-22 12:31:57 +02:00
Michishige Kaito
2de914d8c3 Select the 4th line of output, instead of the second to last line 2014-07-16 18:22:27 +01:00
Michishige Kaito
616fa85458 Add grunt completion 2014-07-16 16:53:18 +01:00
ridiculousfish
20ad496c00 Merge pull request #1559 from davidxia/add-vi-mode-docs-fixes
Fix minor syntax and capitalization mistakes in vi mode docs
2014-07-15 19:05:03 -07:00
David Xia
fa88c42cf1 Fix minor syntax and capitalization mistakes in vi mode docs 2014-07-15 21:59:08 -04:00
David Xia
e84a762171 Add docs for vi mode
fixes #1536
2014-07-15 21:29:02 -04:00
Kevin Ballard
16e50c258a type: Restore combined flags behavior
Fix the parsing of `type` flags to handle combined short flags as
appropriate, e.g. `type -qf ls`.
2014-07-14 11:27:11 -07:00
Kevin Ballard
cce4265cef Fix make test to use local functions
When running `make test` we want to use the local function definitions,
not the ones installed on the system.

The system config.fish will still insert the system definitions at the
end, but at least ours will take precedence.
2014-07-14 00:46:38 -07:00
Kevin Ballard
973dd6ffbd read: Support arrays, character splitting
Enhance the `read` builtin to support creating an array with the --array
flag. With --array, only a single variable name is allowed and the
entire input is tokenized and placed into that variable as an array.

Also add custom behavior if IFS is empty or unset. In that event, split
the input on every character, instead of the previous behavior of doing
no splitting at all.
2014-07-14 00:46:38 -07:00
Kevin Ballard
72e8489d50 command: Rename -p/--path flag to -s/--search 2014-07-13 19:11:29 -07:00
Kevin Ballard
cfa13ed84c Update tests for new type behavior
One of the tests was using `>/dev/null` to suppress the `type` output.
That needs to be `^/dev/null` now, but instead just go ahead and use the
new `-q` flag.
2014-07-13 19:11:29 -07:00
Kevin Ballard
29b3b6b31e type: Stop claiming grep is a function
Use `functions -q` instead of searching the `functiosn -na` list for the
provided word. This may result in an automatically-loaded function being
sourced, but that happens anyway with the default output.

This change means the results of `test -q foo` can be relied upon to
indicate whether `foo` can actually be invoked. Previosly, if `foo` was
the name of an automatically-loaded function file but did not actually
define a function `foo`, and there was no execuable `foo`, then `type -q
foo` would lie and say `foo` can be invoked when it can't.
2014-07-13 19:11:29 -07:00
Kevin Ballard
533496e43a Adopt the new type -q flag in the other functions 2014-07-13 19:11:29 -07:00
Kevin Ballard
6f7a7459c1 test: Add a new --quiet flag to suppress output
The --quiet flag is useful when only the exit status matters.

Fix the documentation for the -t flag to no longer claim that `type` can
print "keyword", as it never does that.

Stop printing a blank line for functions/builtins when the -p flag has
been passed. It's just not useful.
2014-07-13 19:11:29 -07:00
Kevin Ballard
6b062b07b4 type: Separate the notion of multi and paths
Track whether -a and -f have been supplied separately. That way both
`type -a -f command` and `type -f -a command` behaves correctly, as does
`type -a -f foo` where there are multiple executables named `foo` in the
$PATH.
2014-07-13 19:11:29 -07:00
Kevin Ballard
bfd3a47380 Fix type function to work better
Stop using getopt to parse flags. It's far more expensive than
necessary, and results in long flags not being parsed on OS X. This also
allows args starting with - after the options list to be properly
interpreted as a value to test.

Print the error message to stderr as is appropriate.

Use the new `command -p` functionality when the -a flag has not been
provided (`command` does not have any equivalent to the -a flag),
instead of using `which`. This is faster and also avoids any possible
disagreement between `which` and what fish thinks is valid.

Stop testing every path to see if it's executable, that test has already
been done by `which` or `command -p`.

The end result is `type -P ls` is roughly 250% faster, according to
profiling, on my OS X machine.
2014-07-13 19:11:29 -07:00
Kevin Ballard
0933e5cab4 Fix typo in documentation for type builtin 2014-07-13 19:11:29 -07:00
Kevin Ballard
cc565fc16c Teach command builtin a -p/--path flag
Give the `command` builtin a single flag, -p/--path, that causes it to
print the full path that would be executed for the given command.
2014-07-13 19:11:29 -07:00
Kevin Ballard
62d86b3d18 Fix documentation on variable scopes for read
The `read` docs incorrectly asserted that -g was the default for
variables. In actuality it behaves the same way that `set` does.
2014-07-14 09:12:00 +08:00
xzfc
4bbbd2dde6 Fix segfault in status builtin 2014-07-14 09:07:35 +08:00
David Adam
b884117a9e Makefile: just build key_reader with the same objs as fish 2014-07-14 09:06:40 +08:00
ridiculousfish
7def139020 Turn the 'mode' parameter of environment variables into an enum 2014-07-13 17:30:48 -07:00
ridiculousfish
b667eee351 Merge branch 'fix_set_scopes' of github.com:kballard/fish-shell into kballard-fix_set_scopes 2014-07-13 14:12:51 -07:00
ridiculousfish
891f55b2b3 Fix for crash in kill-whole-line
Fixes #1548
2014-07-13 14:06:35 -07:00
Kevin Ballard
7b12fd26f3 Change how we separate toplevel and global scopes
Instead of introducing a new local scope at the point of `set`, merely
push a new local scope at the end of env_init(). This means we have a
single toplevel local scope across the lifetime of the fish process,
which means that

    set -l foo bar
    echo $foo

behaves as expected, without modifying the global environment.
2014-07-13 13:21:06 -07:00
Kevin Ballard
387ec5c06a set: Don't create empty var when erasing index
When using `set -e foo[1]` to erase an index, if the variable doesn't
already exist, return 1 instead of creating it as an empty variable.
2014-07-12 15:43:32 -07:00
Kevin Ballard
dcc043df3b Add an optional mode to env_get_string()
The mode restricts the scope in which the variable is searched for.

Use this new restricted scope functionality in the `set` builtin. This
fixes `set -g` to not show local shadowing variable values, and also
allows for scoped erasing of slices.
2014-07-12 15:35:34 -07:00
Kevin Ballard
2457997cd9 set: Print an error when setting a special var in the wrong scope
When attempting to set a readonly or electric variable in the local or
universal scopes, print an appropriate error. Similarly, print an error
when setting an electric variable as exported. In most cases this is
simply a nicer error instead of the 'read-only' one, but for the 'umask'
variable it prevents `set -l umask 0023` from silently changing the
global value.
2014-07-12 14:07:55 -07:00
Kevin Ballard
d9bed68fe9 Mark COLUMNS/LINES as electric vars
They're dynamically calculated, so they qualify. This also removes them
from the list of exported global variables, because they're actually not
exported.
2014-07-12 14:07:55 -07:00
Kevin Ballard
2eb65b3625 set: Don't treat toplevel scope the same as global
When using the `set` command with the -l flag, if we're at the top
level, create a temporary local scope. This makes query/assignment
behavior be consistent with the value-printing behavior.

This works by marking the current block as needing to pop the
environment if a local scope was pushed. I assume this is safe to do. I
also assume the current block is the right one to modify, rather than
trying to walk up the stack to the root.
2014-07-12 14:07:55 -07:00
Kevin Ballard
76fdfe6890 Rewrite env_exists() for better scope handling
env_exists() wasn't properly handling multiple scopes in some cases,
notably with readonly/electric variables. Rewrite it to operate in a
more straightforward fashion.
2014-07-12 14:07:55 -07:00
ridiculousfish
495adee269 Don't sanity_lose if INTERNAL_BLOCK_NODEs have a null argv
Fixes #1545
2014-07-12 11:01:00 -07:00
Kevin Ballard
383aaa236e Don't allow readonly/electric values to come in through the env
When initializing fish, ignore any inherited environment variables that
match any of the readonly or electric variable names.

This prevents really weird behavior when e.g. fish is launched with
COLUMNS already set to something. In that case, testing $COLUMNS within
fish behaves normally, but any subprocesses get the value that fish
itself had inherited.
2014-07-12 00:53:23 -07:00
Kevin Ballard
8c89e6bce5 Fix typo and tweak set docs
Move the docs for the `-n` flag to `set` out of the list of scopes.
2014-07-12 00:21:04 -07:00
ridiculousfish
98297e5234 Teach while loops to not hang forever with no-execute
Fixes #1543
2014-07-11 11:28:10 -07:00
ridiculousfish
3915faf382 bind should not show -k for bindings that are escape sequences, not keys 2014-07-07 10:45:26 -07:00
ridiculousfish
d5fa4b2ccb Remove errant debug line 2014-07-07 02:01:43 -07:00
ridiculousfish
3ff104ba30 Rename lock_t to mutex_lock_t to fix Solaris compilation
Fixes #1510
2014-07-07 00:38:37 -07:00
Daniel J. Hofmann
706286c289 Fixes use-after-free issue.
Calling writer() might fail in which case launch_buff gets freed.
This patch prevents the subsequent use of memory after it was freed.
2014-07-06 20:54:19 -07:00
ridiculousfish
18c1b12741 Switch variable name in tests from foo to something less likely to be
used accidentally
2014-07-06 20:41:21 -07:00
ridiculousfish
5cda1e55e0 Must load universal variables earlier, and issue a barrier after erasing
one.

Fixes #1526
2014-07-06 18:12:18 -07:00
ridiculousfish
195cd130f8 Fix sense of test in parse_execution to issue a barrier if an external
command has run
2014-07-06 18:12:18 -07:00
ridiculousfish
b19f45e15d Add test for issue 1526 2014-07-06 18:12:18 -07:00
Maxim Gonchar
3acd0dfe48 Add dropbox completion 2014-07-06 20:40:53 +08:00
ridiculousfish
74cedbf1c5 Hopeful fix for Cygwin build (#1530) 2014-07-05 10:22:20 -07:00