对发出的事件做出反应时,Unix对话框实用程序在鱼壳中失败

我有此功能(可以正常使用)

architecture behav of test is

  signal sig    : std_logic_vector(15 downto 0) := x"2224";
  signal index  : integer;

  function finding_first_one (signal a : std_logic_vector()) return integer is
  begin    
    for i in a'low to a'high loop
      if a(i) = '1' then
        return i;
      end if;
    end loop;    
    -- all zero
    return -1;
  end function;

begin

  process (CLK)
  begin
    if rising_edge(clk) then
      index <= finding_first_one(sig);
    end if;
  end process;

end architecture;

当我直接调用function problem_open -e on_problem_open -d "select from existing problems" set matches (find $FD_PROB_HOME/ -maxdepth 1 -mindepth 1 -type d ! -name ".git") if test 1 -eq (count $matches) if test -d $matches set -U FD_PROB_CURRENT $matches[1] echo "chose option 1" return end end set -g dcmd "dialog --stdout --no-tags --menu 'select the file to edit' 20 60 20 " set c 1 for option in $matches set l (basename "$option") set -g dcmd "$dcmd $c '$l'" set c (math $c + 1) end set choice (eval "$dcmd") #clear if test $status -eq 0 echo "edit option $choice" set -U FD_PROB_CURRENT $matches[$choice] end end 时,对话框显示正常。当我通过problem_open间接调用该函数时,对话框不会显示。

有什么想法为什么会这样?是事件的预期行为吗?

我可以解决此问题,但这将是一个谨慎的黑客。

zxcvbnmasd1234 回答:对发出的事件做出反应时,Unix对话框实用程序在鱼壳中失败

与鱼类开发团队成员Fabian Homborg(@faho)讨论后,似乎所需的功能将无法使用(永远不会),原因类似于令人尊敬的“在UI线程中竞争性访问屏幕更新”问题在Windows等。不仅如此,开发团队还打算将来将事件调用实际转移到另一个线程中,因此没有希望通过事件处理程序与终端进行交互。

我最终要做的是创建一个不同的API,当需要用户IO时,它将使用直接函数调用。有关实现,请参见函数_define_subcommand_nonevented

,

您的示例在这里可以,但是有一个技巧是确保手动或在config.fish中定义函数,而不是依赖于自动加载函数。 Functions stored in autoloaded files do not listen to event handlers until they are run the first time

本文链接:https://www.f2er.com/2501874.html

大家都在问