Commit graph

87 commits

Author SHA1 Message Date
Ryan Hileman
f2a5237802 Improve dangerous/undefined PID expansion behavior
1. Use Bash-like expansion for empty searches (when you just use a '%' by
itself).

'%' will now *only* match the last valid backgrounded process.
If there are no such processes, an expansion error will be generated.

'%' by itself would previously match either *all* backgrounded
processes, or failing that, all processes owned by your user. If you
ever tried to run `kill -9 %`, it would either kill all backgrounded
processes or *all* of your processes. I'm not sure why anyone would ever
want that to be a single keystroke away. You could almost typo it.

As a result, `fg %`, `bg %`, `kill %`, etc will all operate on the last
process touched by job control.

2. Don't run 'by-name' matches when the search term is numeric.

This prevents you from running a command like `kill %1` and accidentally
killing a process named something like "1Command". Overloaded behavior
can be dangerous, and we probably shouldn't play fast and loose with
expansion characters that generate process IDs.
2013-09-22 19:54:37 +08:00
ridiculousfish
307a4ae9e8 Don't do completions or autosuggestions for commands with wildcards.
Fixes https://github.com/fish-shell/fish-shell/issues/785
2013-09-11 18:50:14 -07:00
ridiculousfish
c38a40d193 Adjust prefix completions to sort alphabetically instead of by length.
Other completions are still sorted by length.
https://github.com/fish-shell/fish-shell/issues/923
2013-08-31 15:01:02 -07:00
ridiculousfish
92099c7af2 Initial abbreviation work. Tests currently fail. 2013-07-19 12:41:34 -07:00
ridiculousfish
1511de68ed Make parse_util_locate_cmdsubst return the innermost command substitution instead of the outermost.
Fixes https://github.com/fish-shell/fish-shell/issues/913
2013-07-17 01:35:30 -07:00
Ian Ray
b35a2d568a Conditionally include sys/sysctl.h 2013-06-01 23:33:27 -07:00
ridiculousfish
2da81b0ae7 Formatting and style updates 2013-05-05 02:33:17 -07:00
ridiculousfish
d215e86662 Fix for issue where tab completing an empty string would produce no results 2013-04-21 15:49:45 -07:00
ridiculousfish
b8f34cdd35 Teach case-insensitive completions about tildes. Fixes https://github.com/fish-shell/fish-shell/issues/647 2013-04-07 23:54:43 -07:00
ridiculousfish
2cbcc82968 Add some headers to fix the build on OpenBSD
https://github.com/fish-shell/fish-shell/issues/616
2013-03-11 13:38:18 -07:00
ridiculousfish
ad8d68dd43 Make subcommands modify $status, and make builtin_set not modify status unless it fails
https://github.com/fish-shell/fish-shell/issues/547
https://github.com/fish-shell/fish-shell/issues/214
2013-01-31 15:57:08 -08:00
Cheer Xiao
8f045b9ec5 Fix spelling: s/circut/circuit/g 2013-01-24 19:20:06 +08:00
Cheer Xiao
8600243683 Fix two clang warnings 2013-01-17 22:45:06 +08:00
ridiculousfish
373cca0bf6 Formatting 2013-01-12 12:55:23 -08:00
ridiculousfish
b32fcc7a8e Don't call expand_home_directory from within parser_t::test - it may hang
https://github.com/fish-shell/fish-shell/issues/512
2013-01-12 12:53:40 -08:00
ridiculousfish
edb973fadc Hack around xdm's dumb assumption that the login shell is POSIX compliant so we no longer kill OpenSUSE
https://github.com/fish-shell/fish-shell/issues/367
Also fix some formatting
2013-01-04 13:09:01 -08:00
ridiculousfish
882a62ad52 Attempt to fix process expansion on Linux
Hopefully addresses https://github.com/fish-shell/fish-shell/issues/455
2012-12-18 11:37:54 -08:00
situ
e53e00c4f9 Fixed compilation error in expand.cpp
Fixed https://github.com/fish-shell/fish-shell/issues/401
2012-11-22 22:41:36 +05:30
ridiculousfish
e9d216bc84 Fixed recursive brace expansion
https://github.com/fish-shell/fish-shell/issues/399
2012-11-20 13:52:53 -08:00
ridiculousfish
26678682ca Fix indentation of switch statements 2012-11-19 00:31:03 -08:00
ridiculousfish
9992b8eb0e Apply new indentation, brace, and whitespace style 2012-11-18 16:30:30 -08:00
Łukasz Niemier
47df1ae40a Remove trailing whitespaces and change tabs to spaces 2012-11-18 11:23:22 +01:00
ridiculousfish
5bbf220077 Fix bug where underlining was failing for paths prefixed with ~
Fixes https://github.com/fish-shell/fish-shell/issues/292
2012-08-23 11:21:35 -07:00
ridiculousfish
0e2a625815 Added some limited support for autosuggesting processes 2012-08-07 00:01:48 -07:00
ridiculousfish
fdc6c3722a Fixed a bunch of clang analyzer warnings
Simplified some memory allocations by migrating to std::string
2012-08-05 12:01:53 -07:00
ridiculousfish
7a46227141 More warning fixes and switching from int to long or size_t 2012-08-04 13:02:44 -07:00
ridiculousfish
b904aa78e8 Additional warning cleanup and switching from int to size_t where appropriate 2012-08-04 11:34:45 -07:00
Colin Woodbury
eba75dbc2e Fixed two small spelling mistakes
- Saw these during normal usage today.
  "parens" or "parenthesis" was spelled as "parans".
  Fixed two instances of this to "parenthesis".
2012-07-24 22:39:03 +09:00
ridiculousfish
b08fb86637 Renamed env_vars to env_vars_snapshot_t
Cleanup of non-wcstring version of path_get_path
2012-07-20 20:39:31 -07:00
ridiculousfish
bb4a05032b Merge branch 'index_range' 2012-07-19 10:59:11 -07:00
ridiculousfish
d06d6c6964 Various changes to reduce fish's compiled code size
OS X release build executable size dropped from 672k to 511k
2012-07-17 12:47:01 -07:00
ridiculousfish
977a4477f6 Fix for process completion on Linux 2012-07-16 12:19:41 -07:00
ridiculousfish
33c6410809 Implemented process expansion on OS X
Also fixed issue where process expansion would always fail for processes with spaces
Fixes https://github.com/fish-shell/fish-shell/issues/56
2012-07-16 12:06:02 -07:00
ridiculousfish
73e56527bf Improve error message for $? 2012-07-08 18:51:52 -07:00
ridiculousfish
24059924b1 Fix for https://github.com/fish-shell/fish-shell/issues/50
Unescape characters before calling parser.error
2012-07-08 18:40:50 -07:00
maxfl
b25b5bf5f6 restore tabs instead of spaces 2012-07-08 10:55:48 +08:00
maxfl
079f17761c Fix case when first index is command substitution 2012-07-08 09:45:34 +08:00
maxfl
e1b8c425da Fix case when second limit is a variable:
echo $PATH[1..$n]
2012-07-08 09:39:39 +08:00
maxfl
5f05756e65 Add variable expand ranges
echo $PATH[-1..1] #now works

Add tests for ranges
2012-07-08 09:19:11 +08:00
maxfl
c0e996acf8 Implemented index ranges for command substitution
Now the following code works:
> echo (seq 10)[-1..1]
With output:
10
9
8
7
6
5
4
3
2
1
2012-07-07 22:01:28 +08:00
maxfl
41ec58a524 misc 2012-07-07 11:04:29 +08:00
maxfl
0a5e7be129 Add index ranges
Builtin 'set' now can set variable index ranges:
  set test[1..3] a b c #works
  set test[-1..-3] a b c #works if variable have enough elements
  set test[2..-2]  a b c #works
  set test[1..3 -1..-2] a b c b b #works

Expand now can parse index ranges. But not handle for now.

TODO:
  * Add variable substitution index ranges: echo $PATH[-1..1]
  * Add command substitution index range: echo (seq 10)[-1..-4]
  * Add process substitution indexes and ranges: echo %vim[-1]
2012-07-07 10:57:28 +08:00
ridiculousfish
40e4f49dbe Disable process expansion in autosuggestions
Addresses https://github.com/fish-shell/fish-shell/issues/39
2012-06-29 16:40:54 -07:00
ridiculousfish
69446be1ee Signal handling cleanup and improved safety
Fixes issue where you couldn't control-C out of a loop (https://github.com/ridiculousfish/fishfish/issues/13)
Also stops doing memory allocation in the signal handler (oops) https://github.com/ridiculousfish/fishfish/issues/27
2012-06-04 14:20:01 -07:00
ridiculousfish
b7ba252965 Restore implicit cd for paths starting with ., .., or ~ 2012-06-02 14:04:25 -07:00
ridiculousfish
71a8d39372 Fix to restore completions that use command substitution (like cd)
Fix to adopt the same escaping code for both completions and autosuggestions
2012-05-06 13:36:51 -07:00
ridiculousfish
0bc644abf0 Fix lots of bugs related to the static analyzer
Improved how screen.cpp interacts with output_set_writer()
2012-03-26 01:21:10 -07:00
ridiculousfish
31b7d076b7 Remove some dead variables.
Fix screwy output for invalid tilde expansion in expand.cpp
Some cleanup per clang static analyzer
2012-03-25 23:31:03 -07:00
ridiculousfish
d173bb6e0a A bunch of changes working towards eliminating all memory allocation after fork() 2012-03-08 23:21:07 -08:00
ridiculousfish
fdfa5c0602 Some initial work towards resolving nasty fork/pthread issues, and to having a per-parser job list 2012-02-27 18:43:24 -08:00