From 04bfc072c8aa48dcb31076a4568efe119052d6c9 Mon Sep 17 00:00:00 2001
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Date: Mon, 11 Jan 2021 07:53:07 -0600
Subject: [PATCH] =?UTF-8?q?Fix=20#silent=20macro=20runs=20=E2=80=94=20make?=
=?UTF-8?q?=20the=20terminal=20undisrupted.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/editor/editcmd.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
index e2b904604..001ed672d 100644
a
|
b
|
edit_block_process_cmd (WEdit * edit, int macro_number) |
3271 | 3271 | char *fname; |
3272 | 3272 | char *macros_fname = NULL; |
3273 | 3273 | |
| 3274 | /* Prepare the terminal by setting its flag to the initial ones. This will cause \r to work as |
| 3275 | * expected, instead of being ignored. */ |
| 3276 | tty_reset_shell_mode(); |
| 3277 | |
| 3278 | /* Emit the clear screen escape code. */ |
| 3279 | fputs("\x1b[0m\x1b[2J",stdout); |
| 3280 | |
| 3281 | /* Ensure that the codes have been printed out. */ |
| 3282 | fflush(stdout); |
| 3283 | |
3274 | 3284 | fname = g_strdup_printf ("%s.%i.sh", EDIT_HOME_MACRO_FILE, macro_number); |
3275 | 3285 | macros_fname = g_build_filename (mc_config_get_data_path (), fname, (char *) NULL); |
3276 | 3286 | user_menu (edit, macros_fname, 0); |
3277 | 3287 | g_free (fname); |
3278 | 3288 | g_free (macros_fname); |
| 3289 | |
| 3290 | /* Restore the SLang terminal configuration and redraw the editor. */ |
| 3291 | tty_raw_mode(); |
| 3292 | edit_refresh_cmd(); |
3279 | 3293 | edit->force |= REDRAW_COMPLETELY; |
3280 | 3294 | } |
3281 | 3295 | |