mirror of
https://github.com/junegunn/fzf
synced 2026-06-09 10:03:17 +00:00
@@ -4,6 +4,7 @@ CHANGELOG
|
|||||||
0.73.0
|
0.73.0
|
||||||
------
|
------
|
||||||
- Timer-driven `every(N)` event for `--bind`, where `N` is seconds (fractional, floored to `0.01`). Ticks that overlap an in-flight action are coalesced, so a slow `reload` cannot accumulate a backlog.
|
- Timer-driven `every(N)` event for `--bind`, where `N` is seconds (fractional, floored to `0.01`). Ticks that overlap an in-flight action are coalesced, so a slow `reload` cannot accumulate a backlog.
|
||||||
|
- New `FZF_CURRENT_ITEM` environment variable exported to child processes, holding the text of the current item. Useful on shells where quoting `{}` is awkward (e.g. PowerShell on Windows). Unset when the list is empty (#4802).
|
||||||
- New `FZF_IDLE_TIME` (whole seconds) and `FZF_IDLE_TIME_MS` (milliseconds) environment variables exported to child processes, holding the elapsed time since the last user activity. Pair with `every(N)` to build idle-based behavior such as auto-accept or auto-quit (#1211).
|
- New `FZF_IDLE_TIME` (whole seconds) and `FZF_IDLE_TIME_MS` (milliseconds) environment variables exported to child processes, holding the elapsed time since the last user activity. Pair with `every(N)` to build idle-based behavior such as auto-accept or auto-quit (#1211).
|
||||||
```sh
|
```sh
|
||||||
# Live process list; --track --id-nth 2 keeps the cursor on the same PID across reloads
|
# Live process list; --track --id-nth 2 keeps the cursor on the same PID across reloads
|
||||||
|
|||||||
@@ -1475,6 +1475,8 @@ fzf exports the following environment variables to its child processes.
|
|||||||
.br
|
.br
|
||||||
.BR FZF_POS " Vertical position of the cursor in the list starting from 1"
|
.BR FZF_POS " Vertical position of the cursor in the list starting from 1"
|
||||||
.br
|
.br
|
||||||
|
.BR FZF_CURRENT_ITEM " Text of the current item (unset if the list is empty)"
|
||||||
|
.br
|
||||||
.BR FZF_WRAP " The line wrapping mode (char, word) when enabled"
|
.BR FZF_WRAP " The line wrapping mode (char, word) when enabled"
|
||||||
.br
|
.br
|
||||||
.BR FZF_QUERY " Current query string"
|
.BR FZF_QUERY " Current query string"
|
||||||
|
|||||||
@@ -1438,6 +1438,9 @@ func (t *Terminal) environImpl(forPreview bool) []string {
|
|||||||
env = append(env, fmt.Sprintf("FZF_LINES=%d", t.areaLines))
|
env = append(env, fmt.Sprintf("FZF_LINES=%d", t.areaLines))
|
||||||
env = append(env, fmt.Sprintf("FZF_COLUMNS=%d", t.areaColumns))
|
env = append(env, fmt.Sprintf("FZF_COLUMNS=%d", t.areaColumns))
|
||||||
env = append(env, fmt.Sprintf("FZF_POS=%d", min(t.merger.Length(), t.cy+1)))
|
env = append(env, fmt.Sprintf("FZF_POS=%d", min(t.merger.Length(), t.cy+1)))
|
||||||
|
if item := t.currentItem(); item != nil {
|
||||||
|
env = append(env, "FZF_CURRENT_ITEM="+item.AsString(t.ansi))
|
||||||
|
}
|
||||||
env = append(env, fmt.Sprintf("FZF_CLICK_HEADER_LINE=%d", t.clickHeaderLine))
|
env = append(env, fmt.Sprintf("FZF_CLICK_HEADER_LINE=%d", t.clickHeaderLine))
|
||||||
env = append(env, fmt.Sprintf("FZF_CLICK_HEADER_COLUMN=%d", t.clickHeaderColumn))
|
env = append(env, fmt.Sprintf("FZF_CLICK_HEADER_COLUMN=%d", t.clickHeaderColumn))
|
||||||
env = append(env, fmt.Sprintf("FZF_CLICK_FOOTER_LINE=%d", t.clickFooterLine))
|
env = append(env, fmt.Sprintf("FZF_CLICK_FOOTER_LINE=%d", t.clickFooterLine))
|
||||||
|
|||||||
+3
-2
@@ -2286,6 +2286,7 @@ class TestCore < TestInteractive
|
|||||||
FZF_ACTION: 'start',
|
FZF_ACTION: 'start',
|
||||||
FZF_KEY: '',
|
FZF_KEY: '',
|
||||||
FZF_POS: '1',
|
FZF_POS: '1',
|
||||||
|
FZF_CURRENT_ITEM: '1',
|
||||||
FZF_QUERY: '',
|
FZF_QUERY: '',
|
||||||
FZF_POINTER: '>',
|
FZF_POINTER: '>',
|
||||||
FZF_PROMPT: '> ',
|
FZF_PROMPT: '> ',
|
||||||
@@ -2301,12 +2302,12 @@ class TestCore < TestInteractive
|
|||||||
end
|
end
|
||||||
tmux.send_keys :Tab, :Tab
|
tmux.send_keys :Tab, :Tab
|
||||||
tmux.until do
|
tmux.until do
|
||||||
expected.merge!(FZF_ACTION: 'toggle-down', FZF_KEY: 'tab', FZF_POS: '3', FZF_SELECT_COUNT: '2')
|
expected.merge!(FZF_ACTION: 'toggle-down', FZF_KEY: 'tab', FZF_POS: '3', FZF_CURRENT_ITEM: '3', FZF_SELECT_COUNT: '2')
|
||||||
assert_equal expected, env_vars.slice(*expected.keys)
|
assert_equal expected, env_vars.slice(*expected.keys)
|
||||||
end
|
end
|
||||||
tmux.send_keys '99'
|
tmux.send_keys '99'
|
||||||
tmux.until do
|
tmux.until do
|
||||||
expected.merge!(FZF_ACTION: 'char', FZF_KEY: '9', FZF_QUERY: '99', FZF_MATCH_COUNT: '1', FZF_POS: '1')
|
expected.merge!(FZF_ACTION: 'char', FZF_KEY: '9', FZF_QUERY: '99', FZF_MATCH_COUNT: '1', FZF_POS: '1', FZF_CURRENT_ITEM: '99')
|
||||||
assert_equal expected, env_vars.slice(*expected.keys)
|
assert_equal expected, env_vars.slice(*expected.keys)
|
||||||
end
|
end
|
||||||
tmux.send_keys :Space
|
tmux.send_keys :Space
|
||||||
|
|||||||
Reference in New Issue
Block a user