summaryrefslogtreecommitdiffstats
path: root/src/tui.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2021-03-21 15:03:31 -0400
committerNicolas Pitre <nico@fluxnic.net>2021-03-21 15:03:31 -0400
commitb74db350eed9df20237eef9ddb06902d955d47d5 (patch)
tree1a7f6bdec159988b8e02377fcb26322968635a6d /src/tui.c
parent8bf1bc290a850080b1f1505951c01409760d8f98 (diff)
make show_cursor a runtime selectable option
"show_cursor" is the name of the option used with lynx and alpine to produce the same effect.
Diffstat (limited to 'src/tui.c')
-rw-r--r--src/tui.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/src/tui.c b/src/tui.c
index e0b1e17..ae9d9a9 100644
--- a/src/tui.c
+++ b/src/tui.c
@@ -104,10 +104,9 @@ WINDOW * input_win;
SCREEN * sstderr;
SCREEN * sstdout;
-#ifdef BRAILLE
+/* for the "show_cursor" option */
int status_line_empty;
int curwinrow, curwincol;
-#endif
/**
* \brief Called to start UI
@@ -123,9 +122,7 @@ void ui_start_screen() {
main_win = newwin(LINES - RESROW, COLS, get_conf_int("input_bar_bottom") ? 0 : RESROW, 0);
input_win = newwin(RESROW, COLS, get_conf_int("input_bar_bottom") ? LINES-RESROW : 0, 0);
-#ifdef BRAILLE
status_line_empty = 1;
-#endif
#ifdef USECOLORS
if (has_colors()) {
@@ -256,9 +253,7 @@ void ui_sc_msg(char * s, int type, ...) {
mvwprintw(input_win, 1, 0, "%s", t);
wclrtoeol(input_win);
wmove(input_win, 1, 0);
-#ifdef BRAILLE
status_line_empty = 0;
-#endif
if (type == DEBUG_MSG || (loading && type == ERROR_MSG)) {
wtimeout(input_win, -1);
@@ -356,12 +351,12 @@ void ui_do_welcome() {
}
wrefresh(main_win);
-#ifdef BRAILLE
- /* land cursor next to the help line */
- curwinrow = LINES/2;
- curwincol = COLS/2-strlen(msg_help)/2-1;
- status_line_empty = 1;
-#endif
+ if (get_conf_int("show_cursor")) {
+ /* land cursor next to the help line */
+ curwinrow = LINES/2;
+ curwincol = COLS/2-strlen(msg_help)/2-1;
+ status_line_empty = 1;
+ }
return;
}
@@ -439,10 +434,10 @@ void ui_update(int header) {
// Show sc_row headings: 0, 1, 2, 3..
ui_show_sc_row_headings(main_win, mxrow);
-#ifdef BRAILLE
- // Leave cursor on selected cell when no status message
- if (status_line_empty) wmove(main_win, curwinrow, curwincol);
-#endif
+ if (status_line_empty && get_conf_int("show_cursor")) {
+ // Leave cursor on selected cell when no status message
+ wmove(main_win, curwinrow, curwincol);
+ }
// Refresh curses windows
wrefresh(main_win);
@@ -532,13 +527,11 @@ void ui_print_mult_pend() {
wmove(input_win, row_orig, col_orig);
wrefresh(input_win);
-#ifdef BRAILLE
- if (status_line_empty && curmode != EDIT_MODE) {
+ if (status_line_empty && curmode != EDIT_MODE && get_conf_int("show_cursor")) {
// Leave cursor on selected cell when no status message
wmove(main_win, curwinrow, curwincol);
wrefresh(main_win);
}
-#endif
}
/**
@@ -593,9 +586,7 @@ void ui_clr_header(int i) {
// Return cursor to previous position
wmove(input_win, row_orig, col_orig);
-#ifdef BRAILLE
if (i == 1) status_line_empty = 1;
-#endif
return;
}
@@ -1051,12 +1042,10 @@ void ui_show_content(WINDOW * win, int mxrow, int mxcol) {
wclrtoeol(win);
}
-#ifdef BRAILLE
if (currow == row && curcol == col) {
curwinrow = row + 1 - offscr_sc_rows - q_row_hidden;
curwincol = c + ((align == 1) ? (fieldlen - 1) : 0);
}
-#endif
// clean format
#ifndef USECOLORS
@@ -1307,9 +1296,7 @@ void ui_bail(lua_State *L, char * msg) {
set_term(sstderr);
move(0, 0);
clrtobot();
-#ifdef BRAILLE
status_line_empty = 1;
-#endif
clearok(stdscr, TRUE);
mvprintw(0, 0, "%s", stderr_buffer);
stderr_buffer[0]='\0';
@@ -1418,9 +1405,7 @@ char * ui_query(char * initial_msg) {
wclrtoeol(input_win);
wmove(input_win, 1,0);
wclrtoeol(input_win);
-#ifdef BRAILLE
status_line_empty = 1;
-#endif
wrefresh(input_win);
return hline;
}