improve NANO_REFRESH_KEY handling
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3520 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
10f8e880ba
commit
60edb0a989
|
@ -191,7 +191,11 @@ CVS code -
|
||||||
do_statusbar_input()
|
do_statusbar_input()
|
||||||
- Remove redundant check for allow_funcs' being TRUE when we get
|
- Remove redundant check for allow_funcs' being TRUE when we get
|
||||||
KEY_MOUSE. (DLR)
|
KEY_MOUSE. (DLR)
|
||||||
do_yesno()
|
- Improve the handling of NANO_REFRESH_KEY. (DLR)
|
||||||
|
total_statusbar_refresh()
|
||||||
|
- New function, called when we get NANO_REFRESH_KEY in
|
||||||
|
do_statusbar_input(). (DLR)
|
||||||
|
do_yesno_prompt()
|
||||||
- Handle the keys in a switch statement instead of a long if
|
- Handle the keys in a switch statement instead of a long if
|
||||||
block, for simplicity. (DLR)
|
block, for simplicity. (DLR)
|
||||||
- rcfile.c:
|
- rcfile.c:
|
||||||
|
|
|
@ -150,6 +150,10 @@ char *do_browser(char *path, DIR *dir)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* !DISABLE_MOUSE */
|
#endif /* !DISABLE_MOUSE */
|
||||||
|
/* Redraw the screen. */
|
||||||
|
case NANO_REFRESH_KEY:
|
||||||
|
total_redraw();
|
||||||
|
break;
|
||||||
case NANO_HELP_KEY:
|
case NANO_HELP_KEY:
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
do_browser_help();
|
do_browser_help();
|
||||||
|
@ -331,10 +335,6 @@ char *do_browser(char *path, DIR *dir)
|
||||||
/* Start over again with the new path value. */
|
/* Start over again with the new path value. */
|
||||||
free_chararray(filelist, filelist_len);
|
free_chararray(filelist, filelist_len);
|
||||||
goto change_browser_directory;
|
goto change_browser_directory;
|
||||||
/* Redraw the screen. */
|
|
||||||
case NANO_REFRESH_KEY:
|
|
||||||
total_redraw();
|
|
||||||
break;
|
|
||||||
/* Abort the browser. */
|
/* Abort the browser. */
|
||||||
case NANO_EXIT_KEY:
|
case NANO_EXIT_KEY:
|
||||||
abort = TRUE;
|
abort = TRUE;
|
||||||
|
|
34
src/prompt.c
34
src/prompt.c
|
@ -148,6 +148,9 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||||
if (have_shortcut) {
|
if (have_shortcut) {
|
||||||
switch (input) {
|
switch (input) {
|
||||||
/* Handle the "universal" statusbar prompt shortcuts. */
|
/* Handle the "universal" statusbar prompt shortcuts. */
|
||||||
|
case NANO_REFRESH_KEY:
|
||||||
|
total_statusbar_refresh(refresh_func);
|
||||||
|
break;
|
||||||
case NANO_CUT_KEY:
|
case NANO_CUT_KEY:
|
||||||
/* If we're using restricted mode, the filename
|
/* If we're using restricted mode, the filename
|
||||||
* isn't blank, and we're at the "Write File"
|
* isn't blank, and we're at the "Write File"
|
||||||
|
@ -222,9 +225,6 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||||
'\0' || currshortcut != writefile_list)
|
'\0' || currshortcut != writefile_list)
|
||||||
do_statusbar_backspace();
|
do_statusbar_backspace();
|
||||||
break;
|
break;
|
||||||
case NANO_REFRESH_KEY:
|
|
||||||
refresh_func();
|
|
||||||
break;
|
|
||||||
/* Handle the normal statusbar prompt shortcuts, setting
|
/* Handle the normal statusbar prompt shortcuts, setting
|
||||||
* ran_func to TRUE if we try to run their associated
|
* ran_func to TRUE if we try to run their associated
|
||||||
* functions and setting finished to TRUE to indicate
|
* functions and setting finished to TRUE to indicate
|
||||||
|
@ -837,6 +837,16 @@ size_t get_statusbar_page_start(size_t start_col, size_t column)
|
||||||
start_col - 1);
|
start_col - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Put the cursor in the statusbar prompt at statusbar_x. */
|
||||||
|
void reset_statusbar_cursor(void)
|
||||||
|
{
|
||||||
|
size_t start_col = strlenpt(prompt) + 1;
|
||||||
|
size_t xpt = statusbar_xplustabs();
|
||||||
|
|
||||||
|
wmove(bottomwin, 0, start_col + 1 + xpt -
|
||||||
|
get_statusbar_page_start(start_col, start_col + xpt));
|
||||||
|
}
|
||||||
|
|
||||||
/* Repaint the statusbar when getting a character in
|
/* Repaint the statusbar when getting a character in
|
||||||
* get_prompt_string(). The statusbar text line will be displayed
|
* get_prompt_string(). The statusbar text line will be displayed
|
||||||
* starting with curranswer[index]. */
|
* starting with curranswer[index]. */
|
||||||
|
@ -869,16 +879,6 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
||||||
wattroff(bottomwin, reverse_attr);
|
wattroff(bottomwin, reverse_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the cursor in the statusbar prompt at statusbar_x. */
|
|
||||||
void reset_statusbar_cursor(void)
|
|
||||||
{
|
|
||||||
size_t start_col = strlenpt(prompt) + 1;
|
|
||||||
size_t xpt = statusbar_xplustabs();
|
|
||||||
|
|
||||||
wmove(bottomwin, 0, start_col + 1 + xpt -
|
|
||||||
get_statusbar_page_start(start_col, start_col + xpt));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return TRUE if we need an update after moving horizontally, and FALSE
|
/* Return TRUE if we need an update after moving horizontally, and FALSE
|
||||||
* otherwise. We need one if old_pww and statusbar_pww are on different
|
* otherwise. We need one if old_pww and statusbar_pww are on different
|
||||||
* pages. */
|
* pages. */
|
||||||
|
@ -890,6 +890,14 @@ bool need_statusbar_horizontal_update(size_t old_pww)
|
||||||
get_statusbar_page_start(start_col, start_col + statusbar_pww);
|
get_statusbar_page_start(start_col, start_col + statusbar_pww);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unconditionally redraw the entire screen, and then refresh it using
|
||||||
|
* refresh_func(). */
|
||||||
|
void total_statusbar_refresh(void (*refresh_func)(void))
|
||||||
|
{
|
||||||
|
total_redraw();
|
||||||
|
refresh_func();
|
||||||
|
}
|
||||||
|
|
||||||
/* Get a string of input at the statusbar prompt. This should only be
|
/* Get a string of input at the statusbar prompt. This should only be
|
||||||
* called from do_prompt(). */
|
* called from do_prompt(). */
|
||||||
int get_prompt_string(bool allow_tabs,
|
int get_prompt_string(bool allow_tabs,
|
||||||
|
|
|
@ -495,9 +495,10 @@ void do_statusbar_find_bracket(void);
|
||||||
#endif
|
#endif
|
||||||
size_t statusbar_xplustabs(void);
|
size_t statusbar_xplustabs(void);
|
||||||
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||||
void update_statusbar_line(const char *curranswer, size_t index);
|
|
||||||
void reset_statusbar_cursor(void);
|
void reset_statusbar_cursor(void);
|
||||||
|
void update_statusbar_line(const char *curranswer, size_t index);
|
||||||
bool need_statusbar_horizontal_update(size_t old_pww);
|
bool need_statusbar_horizontal_update(size_t old_pww);
|
||||||
|
void total_statusbar_refresh(void (*refresh_func)(void));
|
||||||
int get_prompt_string(bool allow_tabs,
|
int get_prompt_string(bool allow_tabs,
|
||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
bool allow_files,
|
bool allow_files,
|
||||||
|
|
Loading…
Reference in New Issue