miscellaneous minor fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3797 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2006-07-19 13:34:55 +00:00
parent 6e308c0442
commit 23994bd8a0
6 changed files with 30 additions and 33 deletions

View File

@ -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); get_shortcut(browser_list, kbinput, meta_key, func_key);
/* Pico compatibility. */ /* Pico compatibility. */
if (*meta_key == FALSE) { if (!*meta_key) {
switch (*kbinput) { switch (*kbinput) {
case ' ': case ' ':
*kbinput = NANO_NEXTPAGE_KEY; *kbinput = NANO_NEXTPAGE_KEY;

View File

@ -309,13 +309,13 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
fileptr->data[buf_len - 1] = '\0'; fileptr->data[buf_len - 1] = '\0';
#endif #endif
if (*first_line_ins == TRUE) { if (*first_line_ins) {
/* Special case: We're inserting with the cursor on the first /* Special case: We're inserting with the cursor on the first
* line. */ * line. */
fileptr->prev = NULL; fileptr->prev = NULL;
fileptr->next = openfile->fileage; fileptr->next = openfile->fileage;
fileptr->lineno = 1; fileptr->lineno = 1;
if (*first_line_ins == TRUE) { if (*first_line_ins) {
*first_line_ins = FALSE; *first_line_ins = FALSE;
/* If we're inserting into the first line of the file, then /* If we're inserting into the first line of the file, then
* we want to make sure that our edit buffer stays on the * 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); assert(common_len > *place);
} }
if (num_matches > 1 && (common_len != *place || if (num_matches > 1 && (common_len != *place || !*lastwastab))
*lastwastab == FALSE))
beep(); beep();
/* If there is more of a match to display on the statusbar, show /* 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); *place + 1);
strncpy(buf, mzero, common_len); strncpy(buf, mzero, common_len);
*place = common_len; *place = common_len;
} else if (*lastwastab == FALSE || num_matches < 2) } else if (!*lastwastab || num_matches < 2)
*lastwastab = TRUE; *lastwastab = TRUE;
else { else {
int longest_name = 0, columns, editline = 0; 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 /* Only refresh the edit window if we don't have a list of filename
* matches on it. */ * matches on it. */
if (*list == FALSE) if (!*list)
refresh_func(); refresh_func();
/* Enable el cursor. */ /* Enable el cursor. */

View File

@ -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); get_shortcut(help_list, kbinput, meta_key, func_key);
if (*meta_key == FALSE) { if (!*meta_key) {
switch (*kbinput) { switch (*kbinput) {
/* For consistency with the file browser. */ /* For consistency with the file browser. */
case ' ': case ' ':

View File

@ -1325,7 +1325,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
if (allow_funcs) { if (allow_funcs) {
/* If we got a mouse click and it was on a shortcut, read in the /* If we got a mouse click and it was on a shortcut, read in the
* shortcut character. */ * shortcut character. */
if (*func_key == TRUE && input == KEY_MOUSE) { if (*func_key && input == KEY_MOUSE) {
if (do_mouse()) if (do_mouse())
input = get_kbinput(edit, meta_key, func_key); input = get_kbinput(edit, meta_key, func_key);
else { 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 /* 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. */ * function key, and it's not a shortcut or toggle, throw it out. */
if (*s_or_t == FALSE) { if (!*s_or_t) {
if (is_ascii_cntrl_char(input) || *meta_key == TRUE || if (is_ascii_cntrl_char(input) || *meta_key || *func_key) {
*func_key == TRUE) {
statusbar(_("Unknown Command")); statusbar(_("Unknown Command"));
beep(); beep();
*meta_key = FALSE; *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 * it's a normal text character. Display the warning if we're
* in view mode, or add the character to the input buffer if * in view mode, or add the character to the input buffer if
* we're not. */ * we're not. */
if (input != ERR && *s_or_t == FALSE) { if (input != ERR && !*s_or_t) {
if (ISSET(VIEW_MODE)) if (ISSET(VIEW_MODE))
print_view_warning(); print_view_warning();
else { 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 * output all the characters in the input buffer if it isn't
* empty. Note that it should be empty if we're in view * empty. Note that it should be empty if we're in view
* mode. */ * mode. */
if (*s_or_t == TRUE || get_key_buffer_len() == 0) { if (*s_or_t || get_key_buffer_len() == 0) {
#ifndef DISABLE_WRAPPING #ifndef DISABLE_WRAPPING
/* If we got a shortcut or toggle, and it's not the shortcut /* If we got a shortcut or toggle, and it's not the shortcut
* for verbatim input, turn off prepending of wrapped * for verbatim input, turn off prepending of wrapped
* text. */ * text. */
if (*s_or_t == TRUE && (!have_shortcut || s == NULL || if (*s_or_t && (!have_shortcut || s == NULL || s->func !=
s->func != do_verbatim_input)) do_verbatim_input))
wrap_reset(); wrap_reset();
#endif #endif

View File

@ -71,7 +71,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
if (allow_funcs) { if (allow_funcs) {
/* If we got a mouse click and it was on a shortcut, read in the /* If we got a mouse click and it was on a shortcut, read in the
* shortcut character. */ * shortcut character. */
if (*func_key == TRUE && input == KEY_MOUSE) { if (*func_key && input == KEY_MOUSE) {
if (do_statusbar_mouse()) if (do_statusbar_mouse())
input = get_kbinput(bottomwin, meta_key, func_key); input = get_kbinput(bottomwin, meta_key, func_key);
else { else {
@ -97,7 +97,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
#ifndef NANO_TINY #ifndef NANO_TINY
input == NANO_NEXTWORD_KEY || input == NANO_NEXTWORD_KEY ||
#endif #endif
(*meta_key == TRUE && ( (*meta_key && (
#ifndef NANO_TINY #ifndef NANO_TINY
input == NANO_PREVWORD_KEY || input == NANO_BRACKET_KEY || input == NANO_PREVWORD_KEY || input == NANO_BRACKET_KEY ||
#endif #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 /* 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. */ * function key, and it's not a shortcut or toggle, throw it out. */
if (*s_or_t == FALSE) { if (!*s_or_t) {
if (is_ascii_cntrl_char(input) || *meta_key == TRUE || if (is_ascii_cntrl_char(input) || *meta_key || *func_key) {
*func_key == TRUE) {
beep(); beep();
*meta_key = FALSE; *meta_key = FALSE;
*func_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 * it's a normal text character. Display the warning if we're
* in view mode, or add the character to the input buffer if * in view mode, or add the character to the input buffer if
* we're not. */ * 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, /* If we're using restricted mode, the filename isn't blank,
* and we're at the "Write File" prompt, disable text * and we're at the "Write File" prompt, disable text
* input. */ * 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 /* 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 * waiting after the one we read in, we need to display all the
* characters in the input buffer if it isn't empty. */ * 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) { if (kbinput != NULL) {
/* Display all the characters in the input buffer at /* Display all the characters in the input buffer at
* once, filtering out control characters. */ * 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); do_statusbar_next_word(FALSE);
break; break;
case NANO_PREVWORD_KEY: case NANO_PREVWORD_KEY:
if (*meta_key == TRUE) if (*meta_key)
do_statusbar_prev_word(FALSE); do_statusbar_prev_word(FALSE);
break; break;
#endif #endif
@ -204,12 +203,12 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
break; break;
#ifndef NANO_TINY #ifndef NANO_TINY
case NANO_BRACKET_KEY: case NANO_BRACKET_KEY:
if (*meta_key == TRUE) if (*meta_key)
do_statusbar_find_bracket(); do_statusbar_find_bracket();
break; break;
#endif #endif
case NANO_VERBATIM_KEY: case NANO_VERBATIM_KEY:
if (*meta_key == TRUE) { if (*meta_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"
* prompt, disable verbatim input. */ * prompt, disable verbatim input. */

View File

@ -617,7 +617,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
} }
#ifdef DEBUG #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 #endif
/* Return the result. */ /* Return the result. */
@ -1126,7 +1126,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
} }
#ifdef DEBUG #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 #endif
return retval; return retval;
@ -1172,7 +1172,7 @@ int parse_escape_seq_kbinput(int kbinput, bool *ignore_seq)
free(seq); free(seq);
#ifdef DEBUG #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 #endif
return retval; 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); size_t slen = length_of_list(s_list);
#ifdef DEBUG #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 #endif
/* Check for shortcuts. */ /* Check for shortcuts. */
@ -1635,9 +1635,9 @@ const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
* shortcut list. */ * shortcut list. */
if (*kbinput != NANO_NO_KEY && (*kbinput == s->ctrlval || if (*kbinput != NANO_NO_KEY && (*kbinput == s->ctrlval ||
(*meta_key == TRUE && (*kbinput == s->metaval || (*meta_key && (*kbinput == s->metaval || *kbinput ==
*kbinput == s->miscval)) || (*func_key == TRUE && s->miscval)) || (*func_key && *kbinput ==
*kbinput == s->funcval))) { s->funcval))) {
break; break;
} }