Commit graph

40 commits

Author SHA1 Message Date
Sanne Wouda
32936b0eb9 Change lookahead_list into a queue
Using builtin `commandline -f`, one would expect to have commands executed in
the order that they were given.  This motivates the change to a queue.

Unfortunately, fish internals still need lookahead_list to act as a stack.  Add
and rename functions to support both cases and have lookahead_list as
a std::deque internally.

This code is delicate, and we should probably dog-food this in nightly for
a while before the next-minor release.

Fixes #1567
2015-04-19 16:56:48 -07:00
ridiculousfish
b3b83449cf Clean up some memory allocation in builtin_commandline 2014-10-30 18:52:37 -07:00
Kevin Ballard
02a07164f3 Make commandline -P actually work
`commandline --paging-mode` worked but the short flags list accidentally
omitted the documented `-P`.
2014-08-24 14:47:05 -07:00
ridiculousfish
06400b83b1 Support for command wrapping ("aliases")
Add the --wraps option to 'complete' and 'function'. This allows a
command to (recursively) inherit the completions of a wrapped command.
Fixes #393.

When evaluating a completion, we inspect the entire "wrap chain" for a
command, i.e. we follow the sequence of wrapping until we either hit a
loop (which we silently ignore) or the end of the chain. We then
evaluate completions as if the wrapping command were substituted with
the wrapped command. Currently this only works for commands, i.e.
'complete --command gco --wraps git\ checkout' won't work (that would
seem to encroaching on abbreviations anyways). It might be useful to
show an error message for that case.

The commandline builtin reflects the commandline with the wrapped
command substituted in, so e.g. git completions (which inspect the
command line) will just work. This sort of command line munging is
also performed by 'complete -C' so it's not totally without precedent.

'alias will also now mark its generated function as wrapping the
'target.
2014-08-15 18:14:36 -07:00
ridiculousfish
0d3169ef70 Run restyle.sh to enforce style rules. 2014-03-31 10:01:39 -07:00
ridiculousfish
bd895aa76c Changes to bind_mode implementation based on code review and merge
errors
2014-03-30 16:58:46 -07:00
ridiculousfish
d4fafeb6d6 Merge branch 'master' into 1218_rebase
Conflicts:
	builtin.cpp
	builtin_commandline.cpp
	highlight.cpp
	input.cpp
	input.h
	reader.cpp
	screen.cpp
	screen.h
2014-03-29 14:19:45 -07:00
Daniel J. Hofmann
7dc0b6f40b Fixed various Undefined Behavior occurrences.
Conditionally uninitialized:
 - builtin_commandline.cpp:577
 - expand.cpp:869
 - parse_util.cpp:1036

Initialization of POD structs:
 - event.cpp:61
 - autoload.cpp:22

References used with va_start:
 - common.cpp:608:18

Found with clang-3.4's awesome -Wconditional-uninitialized,
-Wmissing-field-initializers and -Wvarargs.
2014-03-07 18:28:16 +01:00
ridiculousfish
be33d3f2a4 Revert "Merge pull request #1317 from pullreq/cpp"
This reverts commit 74135c0600, reversing
changes made to 6d749789ce.

See discussion in #1317
2014-02-28 02:16:48 -08:00
Geoff Nixon
18dd6f58e3 Fixes .c -> .cpp in comments. For doxygen. 2014-02-27 06:23:40 -08:00
Julian Aron Prenner
3728fc7dba Add kill-selection function and visual binds for 'y' and 'd' 2014-01-18 10:18:29 +01:00
ridiculousfish
32054b6f32 Implement and document new -P / --paging-mode flags to commandline, to support new
pager
2014-01-17 12:53:01 -08:00
ridiculousfish
c6e5201e15 Initial support for navigating completions that appear under the
commandline using arrow keys
2014-01-17 12:04:03 -08:00
Julian Aron Prenner
88eae68987 Fix a bug, commandline -s works now as expected. Add "*y binding in
visual mode
2014-01-17 20:32:24 +01:00
Julian Aron Prenner
213e907044 Merge remote-tracking branch 'upstream/master' into bind_mode
Conflicts:
	builtin.cpp
	reader.cpp
	share/functions/fish_default_key_bindings.fish
2014-01-15 15:27:06 +01:00
Julian Aron Prenner
c8d5131a42 Add experimental support for selection and visual mode 2014-01-15 15:07:22 +01:00
ridiculousfish
89069fdaa4 Miscellaneous minor fixes based on cppcheck static analyzer 2014-01-12 13:33:35 -08:00
ridiculousfish
cf766b55cc Fix formatting 2013-10-26 15:27:39 -07:00
ridiculousfish
cbe615224d Make tok_last_type return an enum token_type instead of int 2013-09-30 13:57:36 -07:00
ridiculousfish
db0659aab4 Fix a sign warning 2013-04-03 18:27:18 -07:00
ridiculousfish
90495f3ac5 Implement new newline-escaping behavior. Backslashes at the end of lines now essentially delete the newline, within normal text or double quotes. Backslashes are retained within single quotes.
Fixes https://github.com/fish-shell/fish-shell/issues/347
Fixes https://github.com/fish-shell/fish-shell/issues/52
2012-11-22 01:09:07 -08:00
ridiculousfish
7117c4a5ee Remove tok_destroy 2012-11-21 22:14:28 -08:00
ridiculousfish
f545fb2491 Work towards refactoring tokenizer to be a real object 2012-11-21 17:48:35 -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
c67702a498 Cleaned up lots of typecasts, simplified some string handling 2012-08-04 15:11:43 -07:00
ridiculousfish
54ceb4211e Additional warning fixes and migration from int to size_t or long where appropriate 2012-08-04 13:47:56 -07:00
ridiculousfish
8185bee4b8 Lots of work towards making fish build without warnings on Mountain Lion, mostly in terms of using size_t instead of int 2012-08-04 11:34:45 -07:00
ridiculousfish
2e1b3325c6 Warning cleanup 2012-08-04 11:34:45 -07:00
ridiculousfish
b1bfa71338 Merge branch 'master' into CPlusPlus
Conflicts:
	builtin_commandline.cpp
	util.c
2012-04-18 13:41:39 -07:00
ridiculousfish
376e199ebb Removed a lot of string_buffer_t 2012-02-22 12:00:02 -08:00
ridiculousfish
a837a27b34 Replace some string_buffer_t with wcstring 2012-02-22 11:07:34 -08:00
ridiculousfish
62bd43f17f Large set of changes to migrate sb_out and sb_err to wcstring 2012-02-22 10:51:06 -08:00
ridiculousfish
a534c397f5 Const correctness changes 2012-02-06 00:57:43 -08:00
ridiculousfish
b43c8da66b More work towards instanced parser. First successful compilation 2012-01-22 21:40:08 -08:00
ridiculousfish
3d8face1f9 More work on instancing the parser 2012-01-19 10:28:44 -08:00
ridiculousfish
fa796d668f Get some basic function signatures right for new instanced parser 2012-01-16 12:10:08 -08:00
ridiculousfish
8d2f107d61 Some changes to migrate towards C++ and a multithreaded model 2011-12-26 19:18:46 -08:00
ridiculousfish
3f16ace678 Initial C++ conversion 2011-12-26 19:11:54 -08:00
Renamed from builtin_commandline.c (Browse further)