summaryrefslogtreecommitdiffstats
path: root/src/pacman/sighandler.c
diff options
context:
space:
mode:
authorAnatol Pomozov <anatol.pomozov@gmail.com>2020-03-09 19:54:17 +0100
committerAllan McRae <allan@archlinux.org>2020-03-13 02:24:01 +0100
commit87b74fcd8257e3c2fbf2f2949f0561df7517ce71 (patch)
tree2140c27642963ee12c57d238a1a46f4e85de139d /src/pacman/sighandler.c
parentddd5b0a462e7beb0e086bb51184934868ded3525 (diff)
downloadpacman-87b74fcd8257e3c2fbf2f2949f0561df7517ce71.tar.gz
pacman-87b74fcd8257e3c2fbf2f2949f0561df7517ce71.tar.xz
Hide cursor while pacman is running
Use ASCII control codes to hide cursor at the pacman start and then show the cursor when pacman finishes. It helps to avoid annoying blinking when progress bars are re-drawn. Cursor is reenabled if pacman expects user's input. Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman/sighandler.c')
-rw-r--r--src/pacman/sighandler.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pacman/sighandler.c b/src/pacman/sighandler.c
index 46e6481f..fc4ea766 100644
--- a/src/pacman/sighandler.c
+++ b/src/pacman/sighandler.c
@@ -60,6 +60,8 @@ static void soft_interrupt_handler(int signum)
const char msg[] = "\nHangup signal received\n";
xwrite(STDERR_FILENO, msg, ARRAYSIZE(msg) - 1);
}
+ xwrite(STDOUT_FILENO, CURSOR_SHOW_ANSICODE,
+ sizeof(CURSOR_SHOW_ANSICODE) - 1);
if(alpm_trans_interrupt(config->handle) == 0) {
/* a transaction is being interrupted, don't exit pacman yet. */
return;
@@ -95,6 +97,8 @@ static void segv_handler(int signum)
const char msg[] = "\nerror: segmentation fault\n"
"Please submit a full bug report with --debug if appropriate.\n";
xwrite(STDERR_FILENO, msg, sizeof(msg) - 1);
+ xwrite(STDOUT_FILENO, CURSOR_SHOW_ANSICODE,
+ sizeof(CURSOR_SHOW_ANSICODE) - 1);
/* restore the default handler */
_reset_handler(signum);