Commit Graph

12 Commits

Author SHA1 Message Date
Johannes Altmanninger
d40d2b786f Work around wants_terminal not begin set inside eval
On this binding we fail to disable CSI u

    bind c-t '
        begin
            set -lx FZF_DEFAULT_OPTS --height 40% --bind=ctrl-z:ignore
            eval fzf | while read -l r; echo read $r; end
        end
    '

because for "fzf", ParseExecutionContext::setup_group() returns early with the
parent process group (which should be fish's own) , hence "wants_terminal"
is false. This seems questionable, I don't think the eval should make a
difference here.

For now, don't touch it; use the more accurate way of detecting whether
a process may read keyboard input. In many of such cases "wants_terminal"
is false, like

    echo (echo 1\n2\n3 | fzf)

Fixes #10504
2024-05-18 20:55:06 +02:00
Fabian Boehm
3af849d739 tests/pexpect: Fix \d escape 2024-04-02 22:41:54 +02:00
Fabian Boehm
f7cc1743c6
Allow deciding if a command should be saved to history (#10302)
Call fish_should_add_to_history to see if a command should be saved

If it returns 0, it will be saved, if it returns anything else, it
will be ephemeral.

It gets the right-trimmed text as the argument.

If it doesn't exist, we do the historical behavior of checking for a
leading space.

That means you can now turn that off by defining a
`fish_should_add_to_history` that just doesn't check it.

documentation based on #9298
2024-03-09 12:04:16 +01:00
Fabian Boehm
16c2c14fb4 Restyle 2024-01-07 15:13:34 +01:00
Fabian Boehm
65769bf8c8 history: Allow deleting ranges
This allows giving a range like "5..7".

It works in combination with more (including overlapping) ranges or
single indices.

Fixes #9736
2023-06-10 15:35:40 +02:00
Fabian Boehm
8f08fe80fd Restyle codebase
Not a lot of changes, tbh
2022-06-16 18:43:28 +02:00
Erik Serrander
049104e8df Adds sub-command clear-session to history command.
Issue #5791
This clears all history for the current session. Documentation and
autocompletion for the new subcommand is added.
2021-10-17 19:27:46 -07:00
Fabian Homborg
70e3e0beac Also remove ephemeral item if command is effectively empty
Fixes #8232.

Note that this needed to have expect_prompt used in the pexpect test -
we might want to add a "catchup" there so you can just ignore the
prompt counter for a bit and pick it back up later.
2021-08-20 19:38:16 +02:00
Fabian Homborg
1da56f9937 Make history search smartcase
This makes history searches case-insensitive, unless the search string
contains an uppercase character.

This is what vim calls "smartcase".

Fixes #7273.
2020-09-22 16:13:24 +02:00
ridiculousfish
073334f307 Stop setting TERM in history test
Because TERM was set to something other than 'dumb', we were subject to
syntax highlighting and other interactive features that would affect the
output. In practice we were getting lucky timing-wise, but with upcoming
interactive changes syntax highlighting started to fail this test.
2020-08-22 19:15:54 -07:00
Fabian Homborg
149a0b98af Another formatting run
I really kinda hate how insistent clang-format is to have line
breaks *IFF THE LINE IS TOO LONG*.

Like... lemme just add a break if it looks better, will you?

But it is the style at this time, so we shall tie an onion to our
belt.
2020-06-24 20:43:56 +02:00
Fabian Homborg
c6dffa226f Port history test to pexpect 2020-06-13 19:24:36 +02:00