miscellaneous minor fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3797 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
6e308c0442
commit
23994bd8a0
|
@ -554,7 +554,7 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
|
|||
get_shortcut(browser_list, kbinput, meta_key, func_key);
|
||||
|
||||
/* Pico compatibility. */
|
||||
if (*meta_key == FALSE) {
|
||||
if (!*meta_key) {
|
||||
switch (*kbinput) {
|
||||
case ' ':
|
||||
*kbinput = NANO_NEXTPAGE_KEY;
|
||||
|
|
11
src/files.c
11
src/files.c
|
@ -309,13 +309,13 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
|
|||
fileptr->data[buf_len - 1] = '\0';
|
||||
#endif
|
||||
|
||||
if (*first_line_ins == TRUE) {
|
||||
if (*first_line_ins) {
|
||||
/* Special case: We're inserting with the cursor on the first
|
||||
* line. */
|
||||
fileptr->prev = NULL;
|
||||
fileptr->next = openfile->fileage;
|
||||
fileptr->lineno = 1;
|
||||
if (*first_line_ins == TRUE) {
|
||||
if (*first_line_ins) {
|
||||
*first_line_ins = FALSE;
|
||||
/* If we're inserting into the first line of the file, then
|
||||
* we want to make sure that our edit buffer stays on the
|
||||
|
@ -2258,8 +2258,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
|||
assert(common_len > *place);
|
||||
}
|
||||
|
||||
if (num_matches > 1 && (common_len != *place ||
|
||||
*lastwastab == FALSE))
|
||||
if (num_matches > 1 && (common_len != *place || !*lastwastab))
|
||||
beep();
|
||||
|
||||
/* If there is more of a match to display on the statusbar, show
|
||||
|
@ -2275,7 +2274,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
|||
*place + 1);
|
||||
strncpy(buf, mzero, common_len);
|
||||
*place = common_len;
|
||||
} else if (*lastwastab == FALSE || num_matches < 2)
|
||||
} else if (!*lastwastab || num_matches < 2)
|
||||
*lastwastab = TRUE;
|
||||
else {
|
||||
int longest_name = 0, columns, editline = 0;
|
||||
|
@ -2346,7 +2345,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
|||
|
||||
/* Only refresh the edit window if we don't have a list of filename
|
||||
* matches on it. */
|
||||
if (*list == FALSE)
|
||||
if (!*list)
|
||||
refresh_func();
|
||||
|
||||
/* Enable el cursor. */
|
||||
|
|
|
@ -574,7 +574,7 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key)
|
|||
{
|
||||
get_shortcut(help_list, kbinput, meta_key, func_key);
|
||||
|
||||
if (*meta_key == FALSE) {
|
||||
if (!*meta_key) {
|
||||
switch (*kbinput) {
|
||||
/* For consistency with the file browser. */
|
||||
case ' ':
|
||||
|
|
15
src/nano.c
15
src/nano.c
|
@ -1325,7 +1325,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||
if (allow_funcs) {
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (*func_key == TRUE && input == KEY_MOUSE) {
|
||||
if (*func_key && input == KEY_MOUSE) {
|
||||
if (do_mouse())
|
||||
input = get_kbinput(edit, meta_key, func_key);
|
||||
else {
|
||||
|
@ -1363,9 +1363,8 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (*s_or_t == FALSE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE ||
|
||||
*func_key == TRUE) {
|
||||
if (!*s_or_t) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key || *func_key) {
|
||||
statusbar(_("Unknown Command"));
|
||||
beep();
|
||||
*meta_key = FALSE;
|
||||
|
@ -1379,7 +1378,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||
* it's a normal text character. Display the warning if we're
|
||||
* in view mode, or add the character to the input buffer if
|
||||
* we're not. */
|
||||
if (input != ERR && *s_or_t == FALSE) {
|
||||
if (input != ERR && !*s_or_t) {
|
||||
if (ISSET(VIEW_MODE))
|
||||
print_view_warning();
|
||||
else {
|
||||
|
@ -1395,13 +1394,13 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||
* output all the characters in the input buffer if it isn't
|
||||
* empty. Note that it should be empty if we're in view
|
||||
* mode. */
|
||||
if (*s_or_t == TRUE || get_key_buffer_len() == 0) {
|
||||
if (*s_or_t || get_key_buffer_len() == 0) {
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* If we got a shortcut or toggle, and it's not the shortcut
|
||||
* for verbatim input, turn off prepending of wrapped
|
||||
* text. */
|
||||
if (*s_or_t == TRUE && (!have_shortcut || s == NULL ||
|
||||
s->func != do_verbatim_input))
|
||||
if (*s_or_t && (!have_shortcut || s == NULL || s->func !=
|
||||
do_verbatim_input))
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
|
|
19
src/prompt.c
19
src/prompt.c
|
@ -71,7 +71,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||
if (allow_funcs) {
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (*func_key == TRUE && input == KEY_MOUSE) {
|
||||
if (*func_key && input == KEY_MOUSE) {
|
||||
if (do_statusbar_mouse())
|
||||
input = get_kbinput(bottomwin, meta_key, func_key);
|
||||
else {
|
||||
|
@ -97,7 +97,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||
#ifndef NANO_TINY
|
||||
input == NANO_NEXTWORD_KEY ||
|
||||
#endif
|
||||
(*meta_key == TRUE && (
|
||||
(*meta_key && (
|
||||
#ifndef NANO_TINY
|
||||
input == NANO_PREVWORD_KEY || input == NANO_BRACKET_KEY ||
|
||||
#endif
|
||||
|
@ -108,9 +108,8 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||
|
||||
/* If we got a non-high-bit control key, a meta key sequence, or a
|
||||
* function key, and it's not a shortcut or toggle, throw it out. */
|
||||
if (*s_or_t == FALSE) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key == TRUE ||
|
||||
*func_key == TRUE) {
|
||||
if (!*s_or_t) {
|
||||
if (is_ascii_cntrl_char(input) || *meta_key || *func_key) {
|
||||
beep();
|
||||
*meta_key = FALSE;
|
||||
*func_key = FALSE;
|
||||
|
@ -123,7 +122,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||
* it's a normal text character. Display the warning if we're
|
||||
* in view mode, or add the character to the input buffer if
|
||||
* we're not. */
|
||||
if (input != ERR && *s_or_t == FALSE) {
|
||||
if (input != ERR && !*s_or_t) {
|
||||
/* If we're using restricted mode, the filename isn't blank,
|
||||
* and we're at the "Write File" prompt, disable text
|
||||
* input. */
|
||||
|
@ -139,7 +138,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||
/* If we got a shortcut, or if there aren't any other characters
|
||||
* waiting after the one we read in, we need to display all the
|
||||
* characters in the input buffer if it isn't empty. */
|
||||
if (*s_or_t == TRUE || get_key_buffer_len() == 0) {
|
||||
if (*s_or_t || get_key_buffer_len() == 0) {
|
||||
if (kbinput != NULL) {
|
||||
/* Display all the characters in the input buffer at
|
||||
* once, filtering out control characters. */
|
||||
|
@ -192,7 +191,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||
do_statusbar_next_word(FALSE);
|
||||
break;
|
||||
case NANO_PREVWORD_KEY:
|
||||
if (*meta_key == TRUE)
|
||||
if (*meta_key)
|
||||
do_statusbar_prev_word(FALSE);
|
||||
break;
|
||||
#endif
|
||||
|
@ -204,12 +203,12 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||
break;
|
||||
#ifndef NANO_TINY
|
||||
case NANO_BRACKET_KEY:
|
||||
if (*meta_key == TRUE)
|
||||
if (*meta_key)
|
||||
do_statusbar_find_bracket();
|
||||
break;
|
||||
#endif
|
||||
case NANO_VERBATIM_KEY:
|
||||
if (*meta_key == TRUE) {
|
||||
if (*meta_key) {
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable verbatim input. */
|
||||
|
|
14
src/winio.c
14
src/winio.c
|
@ -617,7 +617,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %s, func_key = %s, escapes = %d, byte_digits = %d, retval = %d\n", *kbinput, (*meta_key == TRUE) ? "TRUE" : "FALSE", (*func_key == TRUE) ? "TRUE" : "FALSE", escapes, byte_digits, retval);
|
||||
fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %s, func_key = %s, escapes = %d, byte_digits = %d, retval = %d\n", *kbinput, *meta_key ? "TRUE" : "FALSE", *func_key ? "TRUE" : "FALSE", escapes, byte_digits, retval);
|
||||
#endif
|
||||
|
||||
/* Return the result. */
|
||||
|
@ -1126,7 +1126,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "get_escape_seq_kbinput(): retval = %d, ignore_seq = %s\n", retval, (*ignore_seq == TRUE) ? "TRUE" : "FALSE");
|
||||
fprintf(stderr, "get_escape_seq_kbinput(): retval = %d, ignore_seq = %s\n", retval, *ignore_seq ? "TRUE" : "FALSE");
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
|
@ -1172,7 +1172,7 @@ int parse_escape_seq_kbinput(int kbinput, bool *ignore_seq)
|
|||
free(seq);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "parse_escape_seq_kbinput(): kbinput = %d, ignore_seq = %s, seq_len = %lu, retval = %d\n", kbinput, (*ignore_seq == TRUE) ? "TRUE" : "FALSE", (unsigned long)seq_len, retval);
|
||||
fprintf(stderr, "parse_escape_seq_kbinput(): kbinput = %d, ignore_seq = %s, seq_len = %lu, retval = %d\n", kbinput, *ignore_seq ? "TRUE" : "FALSE", (unsigned long)seq_len, retval);
|
||||
#endif
|
||||
|
||||
return retval;
|
||||
|
@ -1620,7 +1620,7 @@ const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
|||
size_t slen = length_of_list(s_list);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s, func_key = %s\n", *kbinput, (*meta_key == TRUE) ? "TRUE" : "FALSE", (*func_key == TRUE) ? "TRUE" : "FALSE");
|
||||
fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s, func_key = %s\n", *kbinput, *meta_key ? "TRUE" : "FALSE", *func_key ? "TRUE" : "FALSE");
|
||||
#endif
|
||||
|
||||
/* Check for shortcuts. */
|
||||
|
@ -1635,9 +1635,9 @@ const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
|||
* shortcut list. */
|
||||
|
||||
if (*kbinput != NANO_NO_KEY && (*kbinput == s->ctrlval ||
|
||||
(*meta_key == TRUE && (*kbinput == s->metaval ||
|
||||
*kbinput == s->miscval)) || (*func_key == TRUE &&
|
||||
*kbinput == s->funcval))) {
|
||||
(*meta_key && (*kbinput == s->metaval || *kbinput ==
|
||||
s->miscval)) || (*func_key && *kbinput ==
|
||||
s->funcval))) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue