diff options
author | Anatol Pomozov <anatol.pomozov@gmail.com> | 2020-03-09 19:54:17 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2020-03-13 02:24:01 +0100 |
commit | 87b74fcd8257e3c2fbf2f2949f0561df7517ce71 (patch) | |
tree | 2140c27642963ee12c57d238a1a46f4e85de139d /src/pacman/util.h | |
parent | ddd5b0a462e7beb0e086bb51184934868ded3525 (diff) | |
download | pacman-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/util.h')
-rw-r--r-- | src/pacman/util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pacman/util.h b/src/pacman/util.h index 2cee479f..2b21f3d5 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -28,6 +28,9 @@ #include "util-common.h" +#define CURSOR_HIDE_ANSICODE "\x1B[?25l" +#define CURSOR_SHOW_ANSICODE "\x1B[?25h" + #ifdef ENABLE_NLS #include <libintl.h> /* here so it doesn't need to be included elsewhere */ /* define _() as shortcut for gettext() */ @@ -77,6 +80,9 @@ int colon_printf(const char *format, ...) __attribute__((format(printf, 1, 2))); int yesno(const char *format, ...) __attribute__((format(printf, 1, 2))); int noyes(const char *format, ...) __attribute__((format(printf, 1, 2))); char *arg_to_string(int argc, char *argv[]); +char *safe_fgets_stdin(char *s, int size); +void console_cursor_hide(void); +void console_cursor_show(void); int pm_printf(alpm_loglevel_t level, const char *format, ...) __attribute__((format(printf,2,3))); int pm_asprintf(char **string, const char *format, ...) __attribute__((format(printf,2,3))); |