From 248bfa20f695c0fede3bb3554077e0464e265cbe Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 22 Oct 2023 14:03:14 +0200 Subject: [PATCH] Revert "Set Prolog flag 'tty_control' to 'true' when using pty" This reverts commit d70195ede30df33098f58cc6ba5fd19c26495055. --- sweep.pl | 10 +++++----- sweeprolog.el | 9 +++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/sweep.pl b/sweep.pl index a83816f..6e0feec 100644 --- a/sweep.pl +++ b/sweep.pl @@ -782,7 +782,7 @@ sweep_top_level_start_pty(Name, Id) :- sweep_top_level_pty_client(Name) :- open(Name, read, InStream, [eof_action(reset)]), open(Name, write, OutStream), - sweep_top_level_client(InStream, OutStream, ip(127, 0, 0, 1), true). + sweep_top_level_client(InStream, OutStream, ip(127,0,0,1)). sweep_top_level_server(_, Port) :- tcp_socket(ServerSocket), @@ -809,17 +809,17 @@ sweep_top_level_server_loop_(accept(From), ServerSocket) :- tcp_open_socket(Slave, InStream, OutStream), set_stream(InStream, close_on_abort(false)), set_stream(OutStream, close_on_abort(false)), - sweep_create_thread(sweep_top_level_client(InStream, OutStream, Peer, false), T), + sweep_create_thread(sweep_top_level_client(InStream, OutStream, Peer), T), thread_property(T, id(Id)), thread_send_message(From, client(Id)), sweep_top_level_server_loop(ServerSocket). sweep_top_level_server_loop_(_, _). -sweep_top_level_client(InStream, OutStream, ip(127, 0, 0, 1), TC) :- +sweep_top_level_client(InStream, OutStream, ip(127,0,0,1)) :- !, set_prolog_IO(InStream, OutStream, OutStream), set_stream(InStream, tty(true)), - set_prolog_flag(tty_control, TC), + set_prolog_flag(tty_control, false), set_prolog_flag(verbose, normal), set_prolog_flag(color_term, true), current_prolog_flag(encoding, Enc), @@ -835,7 +835,7 @@ sweep_top_level_client(InStream, OutStream, ip(127, 0, 0, 1), TC) :- close(OutStream, [force(true)]) )), prolog. -sweep_top_level_client(InStream, OutStream, _, _) :- +sweep_top_level_client(InStream, OutStream, _) :- close(InStream), close(OutStream). diff --git a/sweeprolog.el b/sweeprolog.el index c057d5e..b0fd0e0 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -3241,6 +3241,7 @@ top-level." (if sweeprolog-top-level-use-pty (progn (make-comint-in-buffer "sweeprolog-top-level" buf nil) + (setq-local comint-process-echoes t) (process-send-eof (get-buffer-process buf)) (sweeprolog--query-once "sweep" "sweep_top_level_start_pty" (process-tty-name (get-buffer-process buf)))) @@ -3250,6 +3251,7 @@ top-level." buf (cons "localhost" sweeprolog-prolog-server-port)) + (setq-local comint-process-echoes nil) (sweeprolog--query-once "sweep" "sweep_accept_top_level_client" nil))) (let ((proc (get-buffer-process buf))) (set-process-filter proc @@ -3333,12 +3335,7 @@ appropriate buffer." (- pend pstart)))) (not (string= "|: " prompt)) (not (string= "| " prompt))) - (let ((proc (get-buffer-process (current-buffer)))) - (if (eq (process-type proc) 'network) - (comint-send-input) - (delete-char -1) - (process-send-string (get-buffer-process (current-buffer)) - (char-to-string last-command-event)))))))) + (comint-send-input))))) (defun sweeprolog-signal-thread (tid goal) (sweeprolog--query-once "sweep" "sweep_thread_signal" -- 2.39.5