Commit Graph

174 Commits

Author SHA1 Message Date
ridiculousfish
551d2dfebd Merge branch 'master' into ast_templates
Conflicts:
	fish_tests.cpp
2013-07-21 14:04:06 -07:00
ridiculousfish
92099c7af2 Initial abbreviation work. Tests currently fail. 2013-07-19 12:41:34 -07:00
Konrad Borowski
d6c9d3ce94 Use \x1B instead of \e. 2013-07-16 13:42:31 -07:00
ridiculousfish
70b83a3bbb Implement support for switch 2013-06-30 15:38:31 -07:00
ridiculousfish
66af0c1a53 More work on the AST. block statements worked out a bit more. 2013-06-24 12:33:40 -07:00
ridiculousfish
4ca46b7883 Beginning support for new parser error messages 2013-06-15 15:21:35 -07:00
ridiculousfish
827a9d640c Added parse builtin for testing. Lots of work on simulated execution. 2013-06-15 14:32:38 -07:00
ridiculousfish
2da81b0ae7 Formatting and style updates 2013-05-05 02:33:17 -07:00
ridiculousfish
0f12f2b6b1 Formatting cleanup of builtin_contains 2013-04-28 14:35:00 -07:00
ridiculousfish
bcf3accb74 Eliminate a static string from input_terminfo_get_sequence 2013-04-15 13:07:17 -07:00
ridiculousfish
c37c7cee05 Reduce compiled code size a bit 2013-04-13 02:00:31 -07:00
ridiculousfish
b04e874e43 Teach fish how to push and pop blocks even in the face of no_exec. All tests finally pass.
https://github.com/fish-shell/fish-shell/issues/624
2013-03-25 16:06:12 -07:00
Siteshwar Vashisht
d9c9760aac Initial version of printf builtin 2013-03-02 20:54:12 +05:30
ridiculousfish
6d522e6ed6 First round of fixes based on cppcheck
https://github.com/fish-shell/fish-shell/issues/575
2013-02-16 00:02:40 -08:00
ridiculousfish
8d95d0834d First stab at builtin set_color. Moved set_color.cpp to builtin_set_color.cpp and taught fish about it. 2013-02-14 15:52:24 -08:00
Jan Kanis
9a89da3b33 merge branch 'bug-537' and branch 'bug-read-ctrlC'. This should fix both #537 and #516 2013-02-05 23:16:18 +01: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
Jan Kanis
a3b497b271 rename reader_data_t.interruptible to exit_on_interrupt 2013-01-22 11:28:04 +01:00
Jan Kanis
970d05df39 make the read builtin respect ctrl-C 2013-01-20 23:38:21 +01:00
ridiculousfish
6d61919941 Rearrange some variables for possibly better alignment. int -> bool 2013-01-19 13:32:12 -08:00
ridiculousfish
8d4a701f86 Implement builtin [ via builtin test 2013-01-05 01:30:03 -08:00
ridiculousfish
37bdb20092 Make event_block_t.event not a reference
Stylistic tweaks
2012-12-22 12:40:34 -08:00
ridiculousfish
e31431140a Formatting 2012-12-22 12:21:31 -08:00
ridiculousfish
8a66ba6c35 Merge branch 'event-bug-test' of git://github.com/JanKanis/fish-shell into JanKanis-event-bug-test 2012-12-22 12:20:41 -08:00
Jan Kanis
8a446f43ff include fixes and suggestions from code review 2012-12-22 18:38:28 +01:00
ridiculousfish
2a91a7640c Make echo recognize -ne 2012-12-20 18:10:08 -08:00
ridiculousfish
0b1e371880 Changes to work recognition per https://github.com/fish-shell/fish-shell/issues/384
Word movement should be very similar to fish 1.x
backward-kill-word remains more liberal, but now stops at any of {,'"=}
2012-12-20 17:37:09 -08:00
Jan Kanis
30392bf66a reference'ize event.cpp/h 2012-12-20 16:13:14 +01:00
Jan Kanis
af3059ab2a Allow 'emit' to accept event arguments 2012-12-20 16:13:00 +01:00
ridiculousfish
644607c29f Eliminate str2wcs 2012-12-19 13:31:06 -08:00
Cheer Xiao
09b1eee5d0 Random fixes to comments. 2012-12-16 12:23:24 +08:00
ridiculousfish
eec6db0a23 forward-word should accept a word of an autosuggestion
https://github.com/fish-shell/fish-shell/issues/435
2012-12-10 16:23:08 -08:00
ridiculousfish
6fc9e6f21e Make tok_first return a wcstring instead of a wchar_t* 2012-11-21 22:23:48 -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
ridiculousfish
dc8cc39bc8 Don't autosuggest in builtin_read
https://github.com/fish-shell/fish-shell/issues/29
2012-11-18 02:43:35 -08:00
ridiculousfish
d76f880faf Support for fish_right_prompt
Fixes https://github.com/fish-shell/fish-shell/issues/80
2012-11-07 19:59:20 -08:00
ridiculousfish
e52cf09bc1 Simplify handling of escape sequences in echo -e 2012-10-17 17:08:45 -07:00
ridiculousfish
57de1388e8 Make the \c special character in echo suppress the newline too 2012-10-17 02:59:43 -07:00
ridiculousfish
7ee0ce745e Implement -e option to echo (to interpret special characters), and -E to not interpret them
https://github.com/fish-shell/fish-shell/issues/337
2012-10-17 02:56:03 -07:00
Ian Munsie
ffc03735e8 Don't barf when ending a FAKE block
After updating, fish would immediately die when started in an xterm from
my window manager (wmii) with a message like:

fish: builtin.cpp:3357: int builtin_end(parser_t&, wchar_t**): Assertion `false' failed.
fish: Job 1, “~/code/fish-shell/fish” terminated by signal SIGABRT (Abort)

Starting fish from an existing shell worked, and running it on other
machines that I was only SSHing into worked as well. I did discover that
on one machine starting git from one specific directory
(/home/ian/bml/kernel) would cause this failure, but starting from any
other directory worked as normal. I'm not entirely sure what
circumstances contribute to this failure - starting from a copy of the
kernel directory works fine.

The failure only started with the following commit, which introduced the
assert(false):

commit d788c84440
Made type property of block_t constant and private
Further work towards cleaning up block_t hierarchy

Looking at this fail in gdb:

(gdb) r
Starting program: /home/ian/code/fish-shell/fish
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
fish: builtin.cpp:3357: int builtin_end(parser_t&, wchar_t**): Assertion `false' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff6c82475 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
    function=0x548520 "int builtin_end(parser_t&, wchar_t**)") at assert.c:81
(gdb) up 3
3357                    assert(false); //should never get here
(gdb) p parser.current_block->type()
$1 = FAKE

So this happens when we run an end command for a FAKE block.

The below patch adds an empty case for FAKE blocks to avoid hitting the
assert. I would need to study the code in more detail to understand if
we should even be executing this code if we are in a FAKE block, but
this patch seems to solve the issue for me.

Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
2012-09-22 23:51:41 -07:00
ridiculousfish
1a59346b51 Changed "elseif" to "else if" 2012-09-03 13:24:01 -07:00
ridiculousfish
ff124465fd Clean up some warnings and some unused if-related code 2012-09-01 12:29:00 -07:00
ridiculousfish
cc1395797e First stab at elseif implementation 2012-09-01 01:46:14 -07:00
ridiculousfish
95de6cf5a7 Migrated function_data_t out of base block class
Removed an auto_ptr (yay)
2012-08-26 23:30:23 -07:00
ridiculousfish
d788c84440 Made type property of block_t constant and private
Further work towards cleaning up block_t hierarchy
2012-08-26 23:16:20 -07:00
ridiculousfish
96046ffd30 First stab at getting rid of the ugly state1, state2 properties of block_t 2012-08-26 22:42:29 -07:00
ridiculousfish
61686aff34 Adopt posix_spawn (!)
Rewrite IO chains to be a vector of pointers, instead of a linked list
Removed io_transmogrify
2012-08-15 00:57:56 -07:00
ridiculousfish
84729c4dfa Additional warnings cleanup, effective C++ violations, dead code removal 2012-08-05 13:24:33 -07:00
ridiculousfish
c67702a498 Cleaned up lots of typecasts, simplified some string handling 2012-08-04 15:11:43 -07:00
ridiculousfish
b904aa78e8 Additional warning cleanup and switching from int to size_t where appropriate 2012-08-04 11:34:45 -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
e7cbcc83a4 Implemented history deletion from fish_config
Fixes https://github.com/fish-shell/fish-shell/issues/250
2012-07-27 00:31:00 -07:00
ridiculousfish
62c49f13ce Switch from std::list to std::vector in a few places to reduce compiled code size 2012-07-24 22:32:11 -07:00
ridiculousfish
261bf12c91 Lots of miscellaneous cleanup. Unified the path_get_cd_path, path_allocate_cd_path, etc. functions 2012-07-20 22:11:05 -07:00
maxfl
0c03b6ddc7 Allow 'contains' builtin to return index
Add an option -i/--index to the contains builtin to print the index
of first coincidence.
2012-07-10 16:21:00 -07:00
maxfl
232ed91ec7 Fix read default prompt. It's now single line. 2012-07-06 15:31:45 -07:00
maxfl
ea4b37d5c5 Fixed case behaviour
* case no properly handles -h and --help flags, i.e. treats it as
  pattern
* fixed case escaping:
The following expressions now work correctly:
switch '*'
  echo '*'
  echo Match any string
end
switch '*'
  echo '\*'
  echo Match asterix
end
switch '\\'
  echo '\\\\'
  echo Match slash
end

The same for '?' sign
2012-07-05 14:17:25 -07:00
ridiculousfish
7bbc7a61ce Clarify the function name deferral in functions_def
Prohibit making a function with an empty name
2012-07-01 15:33:50 -07:00
maxfl
ab62fe6496 Update funced
* Editor mode is no the default
* Use -i or --interactive or -e fish to edit function in interactive
  mode
* tmpname is now created with random number added and check that file
  do not already exist
* check $TMPDIR existence and put /tmp if it does not exist
* There is an undocumented feature to use functions, started with dash.
  Introduce necessary changes to funced, functions, def_function()
  in order to make it work properly.
* Delete editor guessing. Use $EDITOR variable or -e key
2012-07-01 14:20:43 -07:00
Kevin Ballard
adfd3c1098 Don't blow away $status in switch statements
Tweak the switch and case builtins to not blow away $status
inappropriately. Fixes issue #161.
2012-06-24 13:43:44 -07:00
ridiculousfish
f69489a4fc Mostly fix https://github.com/fish-shell/fish-shell/issues/72 2012-06-21 16:58:26 -07:00
Siteshwar Vashisht
25f9105a97 Made history --help show history man page and history is now saved only once while deleting items 2012-06-12 14:20:07 +05:30
Siteshwar Vashisht
ca61d0ee8b Fixed crash in history builtin for inputs like : history --search -prefix "echo" 2012-06-10 01:08:19 +05:30
ridiculousfish
7698553c3a Made a bare history call end with a newline 2012-06-04 23:59:04 -07:00
Siteshwar Vashisht
ec34f2527a Adding history builtin 2012-06-05 09:54:42 +05:30
ridiculousfish
d09c9fba02 Added a -s option to echo to mean "don't output spaces"
Replaced default prompt to stop calling printf. I opened a bug to replace the default prompt entirely with one that's cheaper.
2012-05-19 16:59:56 -07:00
ridiculousfish
da6295c428 More work towards getting function.h off of shared_ptr 2012-05-17 19:46:08 -07:00
ridiculousfish
86645b32e1 Work towards getting function.h off of shared_ptr 2012-05-17 19:38:08 -07:00
ridiculousfish
9bcc7df96f Lots of modernization changed
Removed wcsdupcat
2012-05-09 02:33:42 -07:00
ridiculousfish
3be07cc645 Fix to start re-respecting CDPATH 2012-05-05 14:30:20 -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
a11687fc5c Make the functions builtin have a bit nicer output
Stop autosuggesting things with newlines
Make webconfig a little nicer
2012-03-25 22:41:22 -07:00
ridiculousfish
f92b24221a Made pwd a builtin
Fixed a thread error when autosuggesting with a command substitution
2012-03-09 20:16:26 -08:00
ridiculousfish
d173bb6e0a A bunch of changes working towards eliminating all memory allocation after fork() 2012-03-08 23:21:07 -08:00
ridiculousfish
ce859c9e92 Added some missing calls to setup_fork_guards() in utilities.
Made echo a builtin
2012-03-07 11:35:22 -08:00
ridiculousfish
6788c2710f Improved error reporting for builtin_test 2012-03-07 01:02:46 -08:00
ridiculousfish
ed7c10f366 Implemented test as a builtin (!) 2012-03-07 00:54:01 -08:00
ridiculousfish
8a46931e34 Remove string_buffer_t (!) 2012-03-03 22:08:34 -08:00
ridiculousfish
3ead99b088 Put fish on a diet. Tracked down the biggest memory hogs and fixed them. Total allocations down by a factor of 3 or so, live allocations a few KB. 2012-03-03 15:22:03 -08:00
ridiculousfish
2da8df6202 Rearrange wopen and stat to avoid a race and hopefully improve performance a little bit. 2012-03-02 11:12:08 -08:00
Peter Ammon
8b26d0104c Some initial changes to use CLO_EXEC, with an eye towards some day using it correctly. 2012-03-02 00:27:40 -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
ridiculousfish
38e40862fe More work towards autosuggesting completions 2012-02-25 18:54:49 -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
Siteshwar Vashisht
74a7303c23 Modified functions in function.h/.cpp to use wcstring instead wchar_t*, other files also modified to use wcstring. 2012-02-19 22:55:15 +05:30
ridiculousfish
0f8ffa6226 For for crash printing backtrace for command "eval cd sldkfjsdlfk" 2012-02-13 11:55:02 -08:00
ridiculousfish
80e8f6a0d1 Removed halloc_wcsdup 2012-02-09 18:59:15 -08:00
ridiculousfish
e5bba2294d Removed some more halloc 2012-02-09 02:01:49 -08:00
ridiculousfish
f891ea5713 Fixed named_arguments to be wcstring_list_t instead of al_list 2012-02-08 23:53:23 -08:00
ridiculousfish
b6bc4381fb Get event_t off of halloc (!) 2012-02-08 19:02:25 -08:00
ridiculousfish
3dc56de0ae Excised some more halloc and array_list_t 2012-02-08 02:34:31 -08:00
ridiculousfish
3f8621e566 CLeanup the io_stack in builtin.cpp, other changes to migrate away from al_list 2012-02-07 23:53:34 -08:00
ridiculousfish
5f686ebb47 Clean up exec_subshell, removing al_list from it 2012-02-07 23:35:41 -08:00
ridiculousfish
006523ac59 Replaced void*data with auto_ptr<function_data_t>, eliminating antoher halloc. 2012-02-07 22:10:35 -08:00
ridiculousfish
399c78fbf7 Fix event_block_t list from ad-hoc linked list to std::dequeue 2012-02-07 21:04:51 -08:00
ridiculousfish
a0a43046b3 Removed discriminated union from block_t type, allowing us to store wcstrings in it 2012-02-07 17:36:54 -08:00
ridiculousfish
a534c397f5 Const correctness changes 2012-02-06 00:57:43 -08:00