tweaks: remove a variable and two functions that have become redundant
Этот коммит содержится в:
родитель
8a5449cebe
Коммит
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);
|
||||
#endif
|
||||
void do_suspend_void(void);
|
||||
void disable_waiting(void);
|
||||
void enable_waiting(void);
|
||||
#ifdef ENABLE_EXTRA
|
||||
void do_credits(void);
|
||||
#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. */
|
||||
|
||||
/* Set non-blocking input so that we can just peek for a Cancel. */
|
||||
disable_waiting();
|
||||
nodelay(edit, TRUE);
|
||||
|
||||
if (begin == NULL)
|
||||
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). */
|
||||
while (input != ERR)
|
||||
input = parse_kbinput(NULL);
|
||||
enable_waiting();
|
||||
nodelay(edit, FALSE);
|
||||
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 (came_full_circle) {
|
||||
enable_waiting();
|
||||
nodelay(edit, FALSE);
|
||||
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. */
|
||||
if (line == NULL) {
|
||||
if (whole_word_only || modus == INREGION) {
|
||||
enable_waiting();
|
||||
nodelay(edit, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
|
||||
|
||||
found_x = found - line->data;
|
||||
|
||||
enable_waiting();
|
||||
nodelay(edit, FALSE);
|
||||
|
||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && (found_x > begin_x ||
|
||||
|
28
src/winio.c
28
src/winio.c
@ -45,8 +45,6 @@ static bool solitary = FALSE;
|
||||
/* Whether an Esc arrived by itself -- not as leader of a sequence. */
|
||||
static int digit_count = 0;
|
||||
/* 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;
|
||||
/* Whether the cursor should be shown when waiting for input. */
|
||||
static bool linger_after_escape = FALSE;
|
||||
@ -185,7 +183,7 @@ void read_keys_from(WINDOW *win)
|
||||
#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) {
|
||||
input = wgetch(win);
|
||||
|
||||
@ -195,11 +193,6 @@ void read_keys_from(WINDOW *win)
|
||||
input = KEY_WINCH;
|
||||
}
|
||||
#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,
|
||||
* assume our input source is gone and die gracefully. We could
|
||||
* check if errno is set to EIO ("Input/output error") and die in
|
||||
@ -221,7 +214,7 @@ void read_keys_from(WINDOW *win)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Read in the remaining characters using non-blocking input. */
|
||||
/* Read in any remaining key codes using non-blocking input. */
|
||||
nodelay(win, TRUE);
|
||||
|
||||
/* After an ESC, when ncurses does not translate escape sequences,
|
||||
@ -246,9 +239,8 @@ void read_keys_from(WINDOW *win)
|
||||
key_buffer[key_buffer_len - 1] = input;
|
||||
}
|
||||
|
||||
/* Restore waiting mode if it was on. */
|
||||
if (waiting_mode)
|
||||
nodelay(win, FALSE);
|
||||
/* Restore blocking-input mode. */
|
||||
nodelay(win, FALSE);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "\nSequence of hex codes:");
|
||||
@ -3316,18 +3308,6 @@ void report_cursor_position(void)
|
||||
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. */
|
||||
void spotlight(size_t from_col, size_t to_col)
|
||||
{
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user