File 1127-erts-to_erl-screen-should-not-be-cleared.patch of Package erlang

From d7b49d6e2124921d43c43f9f4e0a3f02b0230476 Mon Sep 17 00:00:00 2001
From: frazze-jobb <frazze@erlang.org>
Date: Tue, 15 Oct 2024 08:54:25 +0200
Subject: [PATCH 1/3] erts: to_erl screen should not be cleared

When you connect with to_erl, the screen should
not be cleared. Instead the input line should be
redrawn. Changing ^L to ^[l achieves this.
---
 erts/etc/unix/run_erl.c |  4 ++--
 erts/etc/unix/to_erl.c  | 14 +++++---------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/erts/etc/unix/run_erl.c b/erts/etc/unix/run_erl.c
index 6157646630..d86acd72c2 100644
--- a/erts/etc/unix/run_erl.c
+++ b/erts/etc/unix/run_erl.c
@@ -711,8 +711,8 @@ static void pass_on(pid_t childpid)
 #endif
 		    }
 		}
-
-		if (!got_some && wfd && buf[0] == '\014') {
+    if (!got_some && wfd && buf[0] == '\033' &&
+         buf[1] == 'l') {
 		    char wbuf[30];
 		    int wlen = sn_printf(wbuf,sizeof(wbuf),"[run_erl v%u-%u]\n",
 					 RUN_ERL_HI_VER, RUN_ERL_LO_VER);
diff --git a/erts/etc/unix/to_erl.c b/erts/etc/unix/to_erl.c
index 4de4ac4d64..e34c141025 100644
--- a/erts/etc/unix/to_erl.c
+++ b/erts/etc/unix/to_erl.c
@@ -351,16 +351,12 @@ int main(int argc, char **argv)
     show_terminal_settings(&tty_smode);
 #endif
     /*
-     * 	 "Write a ^L to the FIFO which causes the other end to redisplay
-     *    the input line."
-     * This does not seem to work as was intended in old comment above.
-     * However, this control character is now (R12B-3) used by run_erl
-     * to trigger the version handshaking between to_erl and run_erl
-     * at the start of every new to_erl-session.
+     * Write ^[l to the FIFO. This trigger the version handshaking
+     * between to_erl and run_erl and a redraw in erl, at the start
+     * of every new to_erl-session.
      */
-
-    if (write(wfd, "\014", 1) < 0) {
-	fprintf(stderr, "Error in writing ^L to FIFO.\n");
+    if (write(wfd, "\033l", 2) < 0) {
+        fprintf(stderr, "Error in writing ^[l to FIFO.\n");
     }
 
     /*
-- 
2.43.0

openSUSE Build Service is sponsored by