tweaks: improve a couple of comments
parent
123f77ff1a
commit
87283711ee
|
@ -659,15 +659,15 @@ void browser_select_dirname(const char *needle)
|
|||
}
|
||||
}
|
||||
|
||||
/* Set up the system variables for a filename search. Return -1 or -2 if
|
||||
* the search should be canceled (due to Cancel or a blank search string),
|
||||
* return 0 when we have a string, and return a positive value when some
|
||||
* function was run. */
|
||||
/* Prepare the prompt and ask the user what to search for. Return -2
|
||||
* for a blank answer, -1 for Cancel, 0 when we have a string, and a
|
||||
* positive value when some function was run. */
|
||||
int filesearch_init(void)
|
||||
{
|
||||
int input;
|
||||
char *buf;
|
||||
|
||||
/* If something was searched for before, show it between square brackets. */
|
||||
if (*last_search != '\0') {
|
||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||
|
||||
|
@ -679,18 +679,16 @@ int filesearch_init(void)
|
|||
} else
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
/* Now ask what to search for. */
|
||||
input = do_prompt(FALSE, FALSE, MWHEREISFILE, NULL, &search_history,
|
||||
browser_refresh, "%s%s", _("Search"), buf);
|
||||
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
browser_refresh, "%s%s", _("Search"), buf);
|
||||
free(buf);
|
||||
|
||||
/* If only Enter was pressed but we have a previous string, it's okay. */
|
||||
if (input == -2 && *last_search != '\0')
|
||||
return 0;
|
||||
|
||||
/* Otherwise negative inputs are a bailout. */
|
||||
/* Otherwise negative responses are a bailout. */
|
||||
if (input < 0)
|
||||
statusbar(_("Cancelled"));
|
||||
|
||||
|
|
10
src/nano.c
10
src/nano.c
|
@ -551,14 +551,15 @@ void say_there_is_no_help(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Make nano exit gracefully. */
|
||||
/* Exit normally: restore the terminal state and save history files. */
|
||||
void finish(void)
|
||||
{
|
||||
/* Blank the statusbar and (if applicable) the shortcut list,
|
||||
* and move the cursor to the last line of the screen. */
|
||||
/* Blank the statusbar and (if applicable) the shortcut list. */
|
||||
blank_statusbar();
|
||||
blank_bottombars();
|
||||
wrefresh(bottomwin);
|
||||
|
||||
/* Switch on the cursor and exit from curses mode. */
|
||||
curs_set(1);
|
||||
endwin();
|
||||
|
||||
|
@ -582,7 +583,8 @@ void finish(void)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
/* Make nano die gracefully. */
|
||||
/* Die gracefully -- by restoring the terminal state and saving any buffers
|
||||
* that were modified. */
|
||||
void die(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
|
@ -1944,7 +1944,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Represent an invalid sequence with the Replacement Character. */
|
||||
/* Represent an invalid starter byte with the Replacement Character. */
|
||||
converted[index++] = '\xEF';
|
||||
converted[index++] = '\xBF';
|
||||
converted[index++] = '\xBD';
|
||||
|
|
Loading…
Reference in New Issue