Skip to content
Myr

Add missing environment variables (#4356)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by RafaelDominiquini · committed by GitHub · parent 2a9c1c0 · Browse files · 3 files+32 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Rafael Baboni Dominiquini <rafaeldominiquini@gmail.com>
  • Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>

Diff stats

3 files+32 added−15 removed

  • tests:+18 added−15 removed
  • other:+14 added−0 removed

3 files+32 added−15 removed

modified:man/man1/fzf.1+10 added
1277 unmodified lines
1278.BR FZF_NTH " Current \-\-nth option"1279.br1280.BR FZF_PROMPT " Prompt string"1281.br1282.BR FZF_GHOST " Ghost string"1283.br1284.BR FZF_POINTER " Pointer string"1285.br1286.BR FZF_PREVIEW_LABEL " Preview label string"1287.br1288.BR FZF_BORDER_LABEL " Border label string"1289.br1290.BR FZF_LIST_LABEL " List label string"1291.br1292.BR FZF_INPUT_LABEL " Input label string"1293.br1294.BR FZF_HEADER_LABEL " Header label string"1295.br1296.BR FZF_ACTION " The name of the last action performed"1297.br1298.BR FZF_KEY " The name of the last key pressed"1299.br
625 unmodified lines
modified:src/terminal.go+4 added
1089 unmodified lines
1090 env = append(env, "FZF_QUERY="+string(t.input))1091 env = append(env, "FZF_ACTION="+t.lastAction.Name())1092 env = append(env, "FZF_KEY="+t.lastKey)1093 env = append(env, "FZF_PROMPT="+string(t.promptString))1094 env = append(env, "FZF_GHOST="+string(t.ghost))1095 env = append(env, "FZF_POINTER="+string(t.pointer))1096 env = append(env, "FZF_PREVIEW_LABEL="+t.previewLabelOpts.label)1097 env = append(env, "FZF_BORDER_LABEL="+t.borderLabelOpts.label)1098 env = append(env, "FZF_LIST_LABEL="+t.listLabelOpts.label)1099 env = append(env, "FZF_INPUT_LABEL="+t.inputLabelOpts.label)1100 env = append(env, "FZF_HEADER_LABEL="+t.headerLabelOpts.label)1101 if len(t.nthCurrent) > 0 {1102 env = append(env, "FZF_NTH="+RangesToString(t.nthCurrent))1103 }1104 inputState := "enabled"
5270 unmodified lines
modified:test/test_core.rb+18 added-15 removed
1630 unmodified lines
1631 end1632 end16331634 def test_env_vars1635 def to_vars(lines)1636 lines.select { it.start_with?('FZF_') }.to_h do1637 key, val = it.split('=', 2)1635 def env_vars1636 return {} unless File.exist?(tempname)16371638 File.readlines(tempname).select { it.start_with?('FZF_') }.to_h do1639 key, val = it.chomp.split('=', 2)1640 [key.to_sym, val]1641 end1642 end16431642 tmux.send_keys %(seq 100 | #{FZF} --multi --reverse --preview-window up,99%,noborder --preview 'env | grep ^FZF_ | sort' --no-input --bind enter:show-input+refresh-preview,space:disable-search+refresh-preview), :Enter1644 tmux.send_keys %(seq 100 | #{FZF} --multi --reverse --preview-window 0 --preview 'env | grep ^FZF_ | sort > #{tempname}' --no-input --bind enter:show-input+refresh-preview,space:disable-search+refresh-preview), :Enter1645 expected = {1646 FZF_TOTAL_COUNT: '100',1647 FZF_MATCH_COUNT: '100',1648 FZF_SELECT_COUNT: '0',1649 FZF_ACTION: 'start',1650 FZF_KEY: '',1651 FZF_POS: '1',1652 FZF_QUERY: '',1651 FZF_PROMPT: '>',1653 FZF_POINTER: '>',1654 FZF_PROMPT: '> ',1655 FZF_INPUT_STATE: 'hidden'1656 }1654 tmux.until do |lines|1655 assert_equal expected, to_vars(lines).slice(*expected.keys)1657 tmux.until do1658 assert_equal expected, env_vars.slice(*expected.keys)1659 end1660 tmux.send_keys :Enter1658 tmux.until do |lines|1661 tmux.until do1662 expected.merge!(FZF_INPUT_STATE: 'enabled', FZF_ACTION: 'show-input', FZF_KEY: 'enter')1660 assert_equal expected, to_vars(lines).slice(*expected.keys)1663 assert_equal expected, env_vars.slice(*expected.keys)1664 end1665 tmux.send_keys :Tab, :Tab1663 tmux.until do |lines|1666 tmux.until do1667 expected.merge!(FZF_ACTION: 'toggle-down', FZF_KEY: 'tab', FZF_POS: '3', FZF_SELECT_COUNT: '2')1665 assert_equal expected, to_vars(lines).slice(*expected.keys)1668 assert_equal expected, env_vars.slice(*expected.keys)1669 end1670 tmux.send_keys '99'1668 tmux.until do |lines|1671 tmux.until do1672 expected.merge!(FZF_ACTION: 'char', FZF_KEY: '9', FZF_QUERY: '99', FZF_MATCH_COUNT: '1', FZF_POS: '1')1670 assert_equal expected, to_vars(lines).slice(*expected.keys)1673 assert_equal expected, env_vars.slice(*expected.keys)1674 end1675 tmux.send_keys :Space1673 tmux.until do |lines|1676 tmux.until do1677 expected.merge!(FZF_INPUT_STATE: 'disabled', FZF_ACTION: 'disable-search', FZF_KEY: 'space')1675 assert_equal expected, to_vars(lines).slice(*expected.keys)1678 assert_equal expected, env_vars.slice(*expected.keys)1679 end1680 end16811682 def test_abort_action_chain
260 unmodified lines