tweaks: remove a variable and two functions that have become redundant
parent
8a5449cebe
commit
8daa7cbda0
|
@ -634,8 +634,6 @@ void spotlight(size_t from_col, size_t to_col);
|
||||||
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
||||||
#endif
|
#endif
|
||||||
void do_suspend_void(void);
|
void do_suspend_void(void);
|
||||||
void disable_waiting(void);
|
|
||||||
void enable_waiting(void);
|
|
||||||
#ifdef ENABLE_EXTRA
|
#ifdef ENABLE_EXTRA
|
||||||
void do_credits(void);
|
void do_credits(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
10
src/search.c
10
src/search.c
|
@ -185,7 +185,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||||
/* The time we last looked at the keyboard. */
|
/* The time we last looked at the keyboard. */
|
||||||
|
|
||||||
/* Set non-blocking input so that we can just peek for a Cancel. */
|
/* Set non-blocking input so that we can just peek for a Cancel. */
|
||||||
disable_waiting();
|
nodelay(edit, TRUE);
|
||||||
|
|
||||||
if (begin == NULL)
|
if (begin == NULL)
|
||||||
came_full_circle = FALSE;
|
came_full_circle = FALSE;
|
||||||
|
@ -212,7 +212,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||||
/* Clear out the key buffer (in case a macro is running). */
|
/* Clear out the key buffer (in case a macro is running). */
|
||||||
while (input != ERR)
|
while (input != ERR)
|
||||||
input = parse_kbinput(NULL);
|
input = parse_kbinput(NULL);
|
||||||
enable_waiting();
|
nodelay(edit, FALSE);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||||
|
|
||||||
/* If we're back at the beginning, then there is no needle. */
|
/* If we're back at the beginning, then there is no needle. */
|
||||||
if (came_full_circle) {
|
if (came_full_circle) {
|
||||||
enable_waiting();
|
nodelay(edit, FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||||
* but stop when spell-checking or replacing in a region. */
|
* but stop when spell-checking or replacing in a region. */
|
||||||
if (line == NULL) {
|
if (line == NULL) {
|
||||||
if (whole_word_only || modus == INREGION) {
|
if (whole_word_only || modus == INREGION) {
|
||||||
enable_waiting();
|
nodelay(edit, FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||||
|
|
||||||
found_x = found - line->data;
|
found_x = found - line->data;
|
||||||
|
|
||||||
enable_waiting();
|
nodelay(edit, FALSE);
|
||||||
|
|
||||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && (found_x > begin_x ||
|
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && (found_x > begin_x ||
|
||||||
|
|
26
src/winio.c
26
src/winio.c
|
@ -45,8 +45,6 @@ static bool solitary = FALSE;
|
||||||
/* Whether an Esc arrived by itself -- not as leader of a sequence. */
|
/* Whether an Esc arrived by itself -- not as leader of a sequence. */
|
||||||
static int digit_count = 0;
|
static int digit_count = 0;
|
||||||
/* How many digits of a three-digit character code we've eaten. */
|
/* How many digits of a three-digit character code we've eaten. */
|
||||||
static bool waiting_mode = TRUE;
|
|
||||||
/* Whether getting a character will wait for a key to be pressed. */
|
|
||||||
static bool reveal_cursor = FALSE;
|
static bool reveal_cursor = FALSE;
|
||||||
/* Whether the cursor should be shown when waiting for input. */
|
/* Whether the cursor should be shown when waiting for input. */
|
||||||
static bool linger_after_escape = FALSE;
|
static bool linger_after_escape = FALSE;
|
||||||
|
@ -185,7 +183,7 @@ void read_keys_from(WINDOW *win)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read in the first keycode using whatever mode we're in. */
|
/* Read in the first keycode, waiting for it to arrive. */
|
||||||
while (input == ERR) {
|
while (input == ERR) {
|
||||||
input = wgetch(win);
|
input = wgetch(win);
|
||||||
|
|
||||||
|
@ -195,11 +193,6 @@ void read_keys_from(WINDOW *win)
|
||||||
input = KEY_WINCH;
|
input = KEY_WINCH;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (input == ERR && !waiting_mode) {
|
|
||||||
curs_set(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* When we've failed to get a keycode over a hundred times in a row,
|
/* When we've failed to get a keycode over a hundred times in a row,
|
||||||
* assume our input source is gone and die gracefully. We could
|
* assume our input source is gone and die gracefully. We could
|
||||||
* check if errno is set to EIO ("Input/output error") and die in
|
* check if errno is set to EIO ("Input/output error") and die in
|
||||||
|
@ -221,7 +214,7 @@ void read_keys_from(WINDOW *win)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Read in the remaining characters using non-blocking input. */
|
/* Read in any remaining key codes using non-blocking input. */
|
||||||
nodelay(win, TRUE);
|
nodelay(win, TRUE);
|
||||||
|
|
||||||
/* After an ESC, when ncurses does not translate escape sequences,
|
/* After an ESC, when ncurses does not translate escape sequences,
|
||||||
|
@ -246,8 +239,7 @@ void read_keys_from(WINDOW *win)
|
||||||
key_buffer[key_buffer_len - 1] = input;
|
key_buffer[key_buffer_len - 1] = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore waiting mode if it was on. */
|
/* Restore blocking-input mode. */
|
||||||
if (waiting_mode)
|
|
||||||
nodelay(win, FALSE);
|
nodelay(win, FALSE);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -3316,18 +3308,6 @@ void report_cursor_position(void)
|
||||||
cur_xpt, cur_lenpt, colpct, sum, openfile->totsize, charpct);
|
cur_xpt, cur_lenpt, colpct, sum, openfile->totsize, charpct);
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable_waiting(void)
|
|
||||||
{
|
|
||||||
waiting_mode = FALSE;
|
|
||||||
nodelay(edit, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void enable_waiting(void)
|
|
||||||
{
|
|
||||||
waiting_mode = TRUE;
|
|
||||||
nodelay(edit, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Highlight the text between the given two columns on the current line. */
|
/* Highlight the text between the given two columns on the current line. */
|
||||||
void spotlight(size_t from_col, size_t to_col)
|
void spotlight(size_t from_col, size_t to_col)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue