Commit Graph

323 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
6ce74febc7 Accepting an autosuggestion should clear the pager 2014-08-11 10:17:41 -07:00
Gio d'Amelio
bcda3f1baa Set $CMD_DURATION to milliseconds. Fixes #1585 2014-08-04 13:36:39 +08:00
ridiculousfish
b97a94ccc8 Clean up reader_write_title to work with wcstring 2014-08-02 21:01:40 -07:00
jianjun
87abcecca6 add command line string as $argv[1] for fish_title 2014-08-02 12:57:38 -07:00
ridiculousfish
2bb08a4ca0 Make abbreviations work correctly with type-ahead
Fixes #1434
2014-07-25 12:23:42 -07:00
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
891f55b2b3 Fix for crash in kill-whole-line
Fixes #1548
2014-07-13 14:06:35 -07:00
ridiculousfish
0d3169ef70 Run restyle.sh to enforce style rules. 2014-03-31 10:01:39 -07:00
ridiculousfish
28fd1a4c5d Merge branch 'master' of github.com:fish-shell/fish-shell 2014-03-30 21:58:32 -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
aa1b065dd1 Allow appending path hints to history items after they have been added,
allowing us to avoid the delay before items appear in history. Should
fix #984
2014-03-28 23:22:03 -07:00
ridiculousfish
31bf50b2d4 Equip syntax highlighting with a variant that does no disk I/O. Invoke
it after expanding an abbreviation, so that the expanded abbreviation
appears with (some) syntax highlighting.
2014-03-26 18:49:09 -07:00
ridiculousfish
2c19ca0dbf Fix for issue where pager contents may stay around if you executed a
command with pager contents visible
2014-03-20 21:32:02 -07:00
ridiculousfish
73c2846d64 Remove support for input IO_BUFFERs, which were only used by fish_pager 2014-03-15 19:49:55 -07:00
ridiculousfish
2442ae60db Remove old fish_pager source and implementation 2014-03-15 14:00:18 -07:00
ridiculousfish
6c096191ba Remove support for invoking old pager 2014-03-15 13:46:15 -07: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
ridiculousfish
8eaabacf44 Allow double-tapping tab to fully disclose pager, per #291 2014-02-20 13:30:26 -08:00
ridiculousfish
2253c57628 Remove the reader_selected_completion_changed callback. Fix a hang when
the pager gets empty, as reported in 291
2014-02-16 19:59:00 -08:00
ridiculousfish
afd6ca314c Make COMPLETE_AND_SEARCH always show the search field. Also end paging upon
modifying the command line contents.
2014-01-28 07:30:05 -08:00
ridiculousfish
441522f97b Make return not execute the selected completion in the pager, instead
just accept it
2014-01-27 22:01:38 -08:00
ridiculousfish
369229ea71 Make escape clear the current completion 2014-01-27 02:28:19 -08:00
ridiculousfish
15a63805d9 Make arrow keys navigate completions instead of manipulate completion
search field
2014-01-27 02:22:34 -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
ridiculousfish
ce4c145f1c Eliminate dangerous command_length() function. Use editable_line_t in a
few places we missed.
2014-01-26 14:55:41 -08:00
ridiculousfish
b9372944f5 Refactor reader to work on selectable 'editable_line_t' so that most
commands can operate on pager search field
2014-01-26 14:47:15 -08:00
ridiculousfish
f58dff62c7 Beginnings of work for search field feature of new pager 2014-01-26 00:41:30 -08:00
ridiculousfish
0fbddb0df1 Add fish_new_pager variable to enable new pager on request, disabled by default. 2014-01-24 18:10:42 -08:00
ridiculousfish
0a1960865e Support for "merged completions" (multiple completions on the same line)
in new pager. Support for using up-arrow to end pager navigation.
2014-01-24 18:10:41 -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
ridiculousfish
7d3f808e4c Various tweaks and improvements to new pager, including disclosure
feature
2014-01-22 17:45:27 -08: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
ee9a4082b6 Allow down arrow to enter pager. Clean up repainting within
reader_readline
2014-01-21 16:25:55 -08:00
ridiculousfish
f714d80c93 Support for scrolling through the pager 2014-01-21 14:35:18 -08:00
ridiculousfish
605c306bef Correctly clear pager contents on ctrl-C 2014-01-20 13:05:18 -08:00
ridiculousfish
998ce1fe89 Support for correctly resizing pager contents. 2014-01-19 23:52:35 -08:00
ridiculousfish
d9d65577f4 Improved navigation of pager list. Added tests for it too. 2014-01-19 16:41:40 -08:00
ridiculousfish
808bc42f2a Further work on keyboard navigating the completion list 2014-01-18 12:42:53 -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
ridiculousfish
0627ae82fb Clean up pager on exit from interactive read 2014-01-15 18:21:38 -08:00
Julian Aron Prenner
21e9615243 Remove unused #defines 2014-01-15 15:59:13 +01:00
Julian Aron Prenner
9e27ba5109 Pull from upstream 2014-01-15 15:44:27 +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