Commit graph

50 commits

Author SHA1 Message Date
Kevin Ballard
24ac7d2698 Fix commandline behavior in bind functions
When a key is bound to a fish function, if that function invokes
`commandline`, it gets a stale copy of the commandline. This is because
any keys passed to `self-insert` (the default) don't actually get added
to the commandline until a special character is processed, such as the
R_NULL that gets returned after running a binding for a fish command.

To fix this, don't allow fish commands to be run for bindings if we're
processing more than one key. When a key wants to invoke a fish command,
instead we push the invocation sequence back onto the input, followed by
an R_NULL, and return. This causes the input loop to break out and
update the commandline. When it starts up again, it will re-process the
keys and invoke the fish command.

This is primarily an issue with pasting text that includes bound keys in
it. Typed text is slow enough that fish will update the commandline
between each character.

---

I don't know of any way to write a test for this, but the issue can be
reproduced as follows:

    > bind _ 'commandline -i _'

This binds _ to a command that inserts _. Typing the following works:

    > echo wat_is_it

But if you copy that line and paste it instead of typing it, the end
result looks like

    > _echo wat_isit

With this fix in place, the pasted output correctly matches the typed
output.
2014-08-29 12:29:48 -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
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
ridiculousfish
503bbd85b5 Test and fix issue where, if binding X is a prefix of binding Y, and X
is specified before Y, then Y will never be invoked because X will
always get there first. Now instead we order bindings in descending
order by length, so that we always test the binding before any others that
prefixes it. Fixes #1283.
2014-02-12 12:52:31 -08:00
ridiculousfish
7d8766980b Support escape or up-arrow to cancel the completion search field. 2014-01-27 02:17:31 -08:00
ridiculousfish
5be3606236 Increased support for completion search field. Use btab (shift-tab) to
complete-and-search.
2014-01-27 00:56:13 -08:00
Julian Aron Prenner
844b01cb6b Add 'and' input function; fixes a bug with t,T
'and' will prevent later input functions from being executed if the
previous one did not succeed (e.g. a jump to a char not on the command
line)
2014-01-23 10:23:04 +01:00
Julian Aron Prenner
4a9be7bf11 Experimental support for f,F,t,T vi commands.
Input functions can now have arguments
2014-01-22 10:00:44 +01:00
ridiculousfish
9edf9ad2ac Correct the correspondence between name_arr and the input codes. 2014-01-21 16:08:35 -08:00
Julian Aron Prenner
cd64a777c3 Set $fish_bind_mode to default on fish startup; set $fish_key_bindings
when sourcing fish_vi_mode.fish
2014-01-19 10:27:39 +01:00
Julian Aron Prenner
3728fc7dba Add kill-selection function and visual binds for 'y' and 'd' 2014-01-18 10:18:29 +01:00
Julian Aron Prenner
c8d5131a42 Add experimental support for selection and visual mode 2014-01-15 15:07:22 +01:00
Julian Aron Prenner
dc90cd6bc4 Better input handling; add support multiple binding commands 2014-01-01 00:11:32 +01:00
Julian Aron Prenner
2587649ca2 Allow restricting earsing and listing of bindings to specific mode;
implement force repaint and multi-char bindings;
2013-12-31 14:53:29 +01:00
Julian Aron Prenner
d1faac58dd Implement bind modes 2013-12-31 01:52:41 +01:00
Christian Rishøj
cd1c2f74d3 add support for downcase-word, upcase-word and capitalise-word 2013-09-09 18:46:16 +02:00
Christian Rishøj
a259c37415 transpose-words 2013-06-02 00:59:22 -07:00
Christian Rishøj
f32dfe2da6 command and binding for transpose-chars 2013-05-24 23:56:12 -07:00
ridiculousfish
bcf3accb74 Eliminate a static string from input_terminfo_get_sequence 2013-04-15 13:07:17 -07:00
ridiculousfish
d9445f04b1 Use the new input_common_add_callback mechanism to not execute callbacks while signals are blocked. Should fix https://github.com/fish-shell/fish-shell/issues/608 2013-04-03 17:26:02 -07:00
ridiculousfish
2ba92f92b7 Fix for an exception in a non-interactive shell with empty input 2012-12-20 17:45:35 -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
548ea1e54a Added binding for accepting an autosuggestion
Fixes https://github.com/fish-shell/fish-shell/issues/226
2012-07-15 14:02:34 -07:00
Ian Munsie
c8f86d94c9 Add command to temporarily suppress the autosuggestion feature
Autosuggestion will be automatically re-enabled next time a character is
inserted. An alternative implementation would require another command to
explicitly re-enable it.

Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
2012-07-01 15:37:10 -07:00
ridiculousfish
f35d2629d4 Notice when fish_term256 changes and react to it 2012-03-05 14:18:16 -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
4dfe36feb1 Migrate input_function_get_names to wcstring_list_t 2012-01-23 20:48:47 -08:00
ridiculousfish
bef046a51a More work to migrate off of ad-hoc data structures 2011-12-31 15:57:30 -08:00
ridiculousfish
8d2f107d61 Some changes to migrate towards C++ and a multithreaded model 2011-12-26 19:18:46 -08:00
Grissiom
c6372a1b3f remove trailing spaces
This is done by `sed -i -e 's/[ \t]*$//' *.[c,h]`, which should not
introduce any functionality change.
2010-09-18 09:51:16 +08:00
liljencrantz
87db9517e9 Add lots of new code comments.
darcs-hash:20080113164747-75c98-9d0cefd27be7aef7ba60772616d9da7e6bb52912.gz
2008-01-14 02:47:47 +10:00
liljencrantz
4b85eb32d7 Remove readline legacy input function 'winch' and replace its functionality with an event handler function. Once again make the null keybinding do nothing. There are various sitauations where you want to perform a repaint at just the right time, and more or less by luck it worked very well to do this on null, but this really shouldn't happen and no longer does. Hopefully if new repainting issues turn up, they can be fixed at the root instead of once again reapplying this broken bandaid.
darcs-hash:20070930225354-75c98-8e2b518aa0ef694cee889c1c599ff4f158d9eb7f.gz
2007-10-01 08:53:54 +10:00
liljencrantz
feec9579c2 Drop the unneeded input-function delete-line. It was only there for compatiability with readline, which we have dropped.
darcs-hash:20070930073018-75c98-d3abd6e63797c4954778486064f5f55a718f066c.gz
2007-09-30 17:30:18 +10:00
liljencrantz
dde3838f2d Drop the unneeded input-function exit. It was only there for compatiability with readline, which we have rdropped.
darcs-hash:20070929072114-75c98-db188ce2bc31a0668867f9de05ffeed098b988c2.gz
2007-09-29 17:21:14 +10:00
liljencrantz
cf8e746d0c First stab at dropping all support for readlines inputrc files and instead using an internal system for performing keybinding.
darcs-hash:20070925161447-75c98-1feaef88a4b518badb7879f598f06ab650a8f93b.gz
2007-09-26 02:14:47 +10:00
liljencrantz
d2d397d9eb Make up/down cursor move up or down when in multiline mode, except if already in search mode or at the top/bottom line. Since part of this is done in script-space, this involves adding some functionality to the commandline builtin.
darcs-hash:20070921140549-75c98-ba9e83f5e6fdecae5df8f83dd863794c6af9770c.gz
2007-09-22 00:05:49 +10:00
axel
234034d302 Make sure cwd colors update when the variable changes. This is a common regression, it seems. This time it was caused by the repaint reductions added in 1.22.2.
darcs-hash:20061212101348-ac50b-970686fcd3317f19c6131cdc46885a841c68a6d6.gz
2006-12-12 20:13:48 +10:00
axel
728a60bd67 Fix beginning/end-of-line input function, add beginning/end-of-buffer functions
darcs-hash:20061031220149-ac50b-6e6b8f523642bead730059dd96ee2d1290283b5e.gz
2006-11-01 08:01:49 +10:00
axel
7a8b468165 Allow Meta-newline to always insert a newline character
darcs-hash:20061009011529-ac50b-c8e3d77b569bc445e586c95aca01e4433fbff598.gz
2006-10-09 11:15:29 +10:00
axel
d1078f8582 Detect and handle terminals size changes
darcs-hash:20061004214502-ac50b-aaf5b76a6281c0ba8757e794b0a802793ce92916.gz
2006-10-05 07:45:02 +10:00
axel
713748c782 Some minor steps towards making vi-mode work
darcs-hash:20060723205203-ac50b-8125e733ed92689ba847ccbb9076d05910e701ac.gz
2006-07-24 06:52:03 +10:00
axel
2076944268 Use the intern function to share the strings used to describe various key bindings. This saves both performance, code size and memory use, but there is a pathological case where the user continually changes key bindings, resulting in more allocated memory than needed.
darcs-hash:20060621140344-ac50b-c7eb89a94a96538215f9a6737f8e4bacd6a801fb.gz
2006-06-22 00:03:44 +10:00
axel
9ebdc16be6 Fix the longstanding hang-on-exit bug in eterm, as well as making sure the history is saved when the terminal emulator exits
darcs-hash:20060514101623-ac50b-f8ce693ec111e3c158640ef8de309bf7e5484c5b.gz
2006-05-14 20:16:23 +10:00
axel
32b531667a Fix bug that causing terminal corruption if a job is put under job control before running in interactive mode. This is fixed by doing more inits at startup (but only slightly more)
darcs-hash:20060310133809-ac50b-d31cd7bab1a3a58de2833f73735817a3d0b3ed7d.gz
2006-03-10 23:38:09 +10:00
axel
29c488c6dc Fixes to api documentation, added .PHONY to makefile actions, made a few private functions static
darcs-hash:20060123204014-ac50b-b9d2a10c7f00945b5d9d244cb3b8c1489fe280de.gz
2006-01-24 06:40:14 +10:00
James Vega
e27664b13b Add header guards to the header files.
darcs-hash:20051004151139-35ec8-7af69b9d7647d145dc621f7eaea726e729cff554.gz
2005-10-05 01:11:39 +10:00
axel
149594f974 Initial revision
darcs-hash:20050920132639-ac50b-fa3b476891e1f5f67207cf4cc7bf623834cc5edc.gz
2005-09-20 23:26:39 +10:00