tweaks: elide a wrapper function, by checking a precondition earlier
parent
2e6886406c
commit
1388af2bdc
|
@ -789,7 +789,7 @@ void shortcut_init(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
add_to_funcs(do_cursorpos_void, MMAIN,
|
||||
add_to_funcs(report_cursor_position, MMAIN,
|
||||
N_("Location"), WITHORSANS(cursorpos_gist), TOGETHER, VIEW);
|
||||
|
||||
#if defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
|
||||
|
@ -1179,7 +1179,7 @@ void shortcut_init(void)
|
|||
add_to_sclist(MMAIN, "M-F", 0, do_formatter, 0);
|
||||
add_to_sclist(MEXECUTE, "^O", 0, do_formatter, 0);
|
||||
#endif
|
||||
add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0);
|
||||
add_to_sclist(MMAIN, "^C", 0, report_cursor_position, 0);
|
||||
add_to_sclist(MMAIN, "^_", 0, do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN, "M-G", 0, do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER|MHELP|MLINTER, "^Y", 0, do_page_up, 0);
|
||||
|
@ -1458,7 +1458,7 @@ void shortcut_init(void)
|
|||
add_to_sclist(MMAIN|MBROWSER|MHELP|MLINTER, "F8", KEY_F(8), do_page_down, 0);
|
||||
add_to_sclist(MMOST, "F9", KEY_F(9), cut_text, 0);
|
||||
add_to_sclist(MMOST, "F10", KEY_F(10), paste_text, 0);
|
||||
add_to_sclist(MMAIN, "F11", KEY_F(11), do_cursorpos_void, 0);
|
||||
add_to_sclist(MMAIN, "F11", KEY_F(11), report_cursor_position, 0);
|
||||
#ifdef ENABLE_SPELLER
|
||||
add_to_sclist(MMAIN, "F12", KEY_F(12), do_spell, 0);
|
||||
#endif
|
||||
|
|
|
@ -2482,8 +2482,8 @@ int main(int argc, char **argv)
|
|||
bottombars(MMAIN);
|
||||
|
||||
/* Update the displayed current cursor position only when there
|
||||
* are no keys waiting in the input buffer. */
|
||||
if (ISSET(CONSTANT_SHOW) && get_key_buffer_len() == 0)
|
||||
* is no message and no keys are waiting in the input buffer. */
|
||||
if (ISSET(CONSTANT_SHOW) && lastmessage == VACUUM && get_key_buffer_len() == 0)
|
||||
report_cursor_position();
|
||||
|
||||
lastmessage = VACUUM;
|
||||
|
|
|
@ -635,7 +635,6 @@ void adjust_viewport(update_type manner);
|
|||
void full_refresh(void);
|
||||
void draw_all_subwindows(void);
|
||||
void report_cursor_position(void);
|
||||
void do_cursorpos_void(void);
|
||||
void spotlight(size_t from_col, size_t to_col);
|
||||
#ifndef NANO_TINY
|
||||
void spotlight_softwrapped(size_t from_col, size_t to_col);
|
||||
|
|
|
@ -280,7 +280,7 @@ keystruct *strtosc(const char *input)
|
|||
s->func = do_formatter;
|
||||
#endif
|
||||
else if (!strcmp(input, "curpos"))
|
||||
s->func = do_cursorpos_void;
|
||||
s->func = report_cursor_position;
|
||||
else if (!strcmp(input, "gotoline"))
|
||||
s->func = do_gotolinecolumn_void;
|
||||
#ifdef ENABLE_JUSTIFY
|
||||
|
|
11
src/winio.c
11
src/winio.c
|
@ -3367,10 +3367,6 @@ void report_cursor_position(void)
|
|||
size_t cur_lenpt = breadth(openfile->current->data) + 1;
|
||||
int linepct, colpct, charpct;
|
||||
|
||||
/* If there is a message on the status bar, do not overwrite it. */
|
||||
if (lastmessage != VACUUM)
|
||||
return;
|
||||
|
||||
/* Determine the size of the file up to the cursor. */
|
||||
saved_byte = openfile->current->data[openfile->current_x];
|
||||
openfile->current->data[openfile->current_x] = '\0';
|
||||
|
@ -3390,13 +3386,6 @@ void report_cursor_position(void)
|
|||
cur_xpt, cur_lenpt, colpct, sum, openfile->totsize, charpct);
|
||||
}
|
||||
|
||||
/* Unconditionally display the current cursor position. */
|
||||
void do_cursorpos_void(void)
|
||||
{
|
||||
lastmessage = VACUUM;
|
||||
report_cursor_position();
|
||||
}
|
||||
|
||||
void disable_waiting(void)
|
||||
{
|
||||
waiting_mode = FALSE;
|
||||
|
|
Loading…
Reference in New Issue