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)).
+ sweep_top_level_client(InStream, OutStream, ip(127, 0, 0, 1), true).
sweep_top_level_server(_, Port) :-
tcp_socket(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), T),
+ sweep_create_thread(sweep_top_level_client(InStream, OutStream, Peer, false), 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)) :-
+sweep_top_level_client(InStream, OutStream, ip(127, 0, 0, 1), TC) :-
!,
set_prolog_IO(InStream, OutStream, OutStream),
set_stream(InStream, tty(true)),
- set_prolog_flag(tty_control, false),
+ set_prolog_flag(tty_control, TC),
current_prolog_flag(encoding, Enc),
set_stream(user_input, encoding(Enc)),
set_stream(user_output, encoding(Enc)),
close(OutStream, [force(true)])
)),
prolog.
-sweep_top_level_client(InStream, OutStream, _) :-
+sweep_top_level_client(InStream, OutStream, _, _) :-
close(InStream),
close(OutStream).
(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))))
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
(- pend pstart))))
(not (string= "|: " prompt))
(not (string= "| " prompt)))
- (comint-send-input)))))
+ (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))))))))
(defun sweeprolog-signal-thread (tid goal)
(sweeprolog--query-once "sweep" "sweep_thread_signal"