From e0c705f0cee99c5d366ae124fcdcea0d498aee74 Mon Sep 17 00:00:00 2001 From: Joshua Reusch Date: Sun, 20 Oct 2024 15:28:56 +0200 Subject: [PATCH] update tui_ffi platform with the things we've learned --- test/tui_ffi.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/tui_ffi.erl b/test/tui_ffi.erl index d77e39f..bc35a0e 100644 --- a/test/tui_ffi.erl +++ b/test/tui_ffi.erl @@ -15,7 +15,7 @@ %% %% To be able to exit properly on CTRL+C, you have to invoke erlang with the +Bc flag: %% -%% erl -pa ./build/dev/erlang/string_width/ebin -pa ./build/dev/erlang/gleam_stdlib/ebin -pa ./build/dev/erlang/gleeunit/ebin -pa build/dev/erlang/filepath/ebin/ -pa build/dev/erlang/simplifile/ebin/ +Bc -noshell -s human_rights main -s init stop +%% ERL_FLAGS="+Bc" gleam run -m human_rights %% %% Just `gleam run` also works, but will bring up the break handler menu on CTRL+C. %% If you abort, your terminal will still be somewhat broken; a `reset` fixes that. @@ -42,6 +42,7 @@ tui_app(State, OnResize, OnData, View) -> loop(State, OnResize, OnData, View) -> %% io:put_chars(<<"\e[0;0H"/utf8>>), io:put_chars(string:replace(View(State), <<"\n"/utf8>>, <<"\r\n"/utf8>>, all)), + %% io:put_chars(unicode:characters_to_binary(integer_to_list(os:system_time()))), receive { data, Chars } -> case handle_input(Chars, State, OnData) of @@ -61,7 +62,7 @@ loop(State, OnResize, OnData, View) -> end. handle_input(<<>>, State, _OnData) -> State; -%% handle_input(<<3, _rest/bits>>, _State, _OnData) -> stop; +handle_input(<<3, _rest/bits>>, _State, _OnData) -> stop; handle_input(<<"q"/utf8, _rest/bits>>, _State, _OnData) -> stop; handle_input(Rest, State, OnData) -> OnData(State, Rest). @@ -86,6 +87,5 @@ handle_info(_, State) -> handle_call(_Request, State) -> {ok, ok, State}. -terminate(_Args, {Pid} = State) -> - Pid ! { signal, sigint }, +terminate(_Args, _State) -> ok. -- knotmirror 0.0.1