- Remove unneeded call to blank_edit(). (DLR)
- After entering "..", select the directory we were in before
instead of the first filename in the list, as Pico does. (DLR)
+ - Simplify screen update handling. (DLR)
browser_refresh()
- Simplify. (DLR)
- Fix problems where translated versions of "(dir)" could be
allocated, use null_at() to strip the directory from the
string. Also, return the stripped path instead of modifying
path. (DLR)
+- help.c:
+ do_help()
+ - Simplify screen update handling. (DLR)
- doc/syntax/c.nanorc:
- Since .i and .ii are preprocessed C and C++ output, colorize
them here. (Mike Frysinger)
char *do_browser(char *path, DIR *dir)
{
int kbinput;
- bool meta_key, func_key;
- bool old_const_update = ISSET(CONST_UPDATE);
+ bool meta_key, func_key, old_const_update = ISSET(CONST_UPDATE);
char *prev_dir = NULL;
/* The directory we were in, if any, before backing up via
* entering "..". */
}
do {
- bool abort = FALSE;
+ size_t fileline;
+ /* The line number the selected file is on. */
+ size_t old_selected = selected;
+ /* We display the file list only if the selected file
+ * changed. */
struct stat st;
int i;
- size_t fileline;
char *new_path;
/* Compute the line number we're on now, so that we don't divide
/* We can click in the edit window to select a
* file. */
if (wenclose(edit, mouse_y, mouse_x)) {
- size_t old_selected = selected;
-
/* Subtract out the size of topwin. */
mouse_y -= 2 - no_more_space();
* get out. */
if (!S_ISDIR(st.st_mode)) {
retval = mallocstrcpy(NULL, filelist[selected]);
- abort = TRUE;
+ kbinput = NANO_EXIT_KEY;
break;
/* If we've successfully opened a directory, and it's
* "..", save the current directory in prev_dir, so that
/* Start over again with the new path value. */
free_chararray(filelist, filelist_len);
goto change_browser_directory;
- /* Abort the browser. */
- case NANO_EXIT_KEY:
- abort = TRUE;
- break;
}
- if (abort)
- break;
-
- browser_refresh();
+ /* Display the file list if we don't have a key, we do have a
+ * key and the selected file has changed, or if we haven't
+ * updated the screen already. */
+ if ((kbinput == ERR || old_selected == selected) && kbinput !=
+ NANO_REFRESH_KEY)
+ browser_refresh();
kbinput = get_kbinput(edit, &meta_key, &func_key);
parse_browser_input(&kbinput, &meta_key, &func_key);
/* The line number in help_text of the last help line. This
* variable is zero-based. */
int kbinput = ERR;
- bool meta_key, func_key;
- bool old_no_help = ISSET(NO_HELP);
+ bool meta_key, func_key, old_no_help = ISSET(NO_HELP);
#ifndef DISABLE_MOUSE
const shortcut *oldshortcut = currshortcut;
/* We will set currshortcut to allow clicking on the help
break;
}
- if ((kbinput != ERR && line == old_line) || kbinput ==
- NANO_REFRESH_KEY)
- goto skip_redisplay;
-
- blank_edit();
-
- /* Calculate where in the text we should be, based on the
- * page. */
- for (i = 0; i < line; i++) {
- ptr += help_line_len(ptr);
- if (*ptr == '\n')
- ptr++;
- }
+ /* Display the help text if we don't have a key, we do have a
+ * key and the help text has moved, or if we haven't updated the
+ * screen already. */
+ if ((kbinput == ERR || line != old_line) && kbinput !=
+ NANO_REFRESH_KEY) {
+ blank_edit();
+
+ /* Calculate where in the text we should be, based on the
+ * page. */
+ for (i = 0; i < line; i++) {
+ ptr += help_line_len(ptr);
+ if (*ptr == '\n')
+ ptr++;
+ }
- for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
- size_t j = help_line_len(ptr);
+ for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
+ size_t j = help_line_len(ptr);
- mvwaddnstr(edit, i, 0, ptr, j);
- ptr += j;
- if (*ptr == '\n')
- ptr++;
+ mvwaddnstr(edit, i, 0, ptr, j);
+ ptr += j;
+ if (*ptr == '\n')
+ ptr++;
+ }
}
- skip_redisplay:
kbinput = get_kbinput(edit, &meta_key, &func_key);
parse_help_input(&kbinput, &meta_key, &func_key);
} while (kbinput != NANO_EXIT_KEY);