re-indent winio.c
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1020 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
69bba322f5
commit
598106e55a
63
winio.c
63
winio.c
|
@ -241,8 +241,7 @@ void nanoget_repaint(char *buf, char *inputbuf, int x)
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
mvwaddstr(bottomwin, 0, 0, buf);
|
||||||
waddnstr(bottomwin, inputbuf, wid);
|
waddnstr(bottomwin, inputbuf, wid);
|
||||||
wmove(bottomwin, 0, (x % COLS));
|
wmove(bottomwin, 0, (x % COLS));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Black magic */
|
/* Black magic */
|
||||||
buf[len - 1] = '$';
|
buf[len - 1] = '$';
|
||||||
|
|
||||||
|
@ -299,8 +298,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||||
|
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
/* Have to do this here, it would be too late to do it in statusq */
|
/* Have to do this here, it would be too late to do it in statusq */
|
||||||
if (kbinput == NANO_HELP_KEY
|
if (kbinput == NANO_HELP_KEY || kbinput == NANO_HELP_FKEY) {
|
||||||
|| kbinput == NANO_HELP_FKEY) {
|
|
||||||
do_help();
|
do_help();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -463,7 +461,8 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||||
|
|
||||||
for (j = 0; j <= slen - 1; j++) {
|
for (j = 0; j <= slen - 1; j++) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
|
fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput,
|
||||||
|
kbinput);
|
||||||
#endif
|
#endif
|
||||||
if (kbinput == s[j].val || kbinput == s[j].val - 32) {
|
if (kbinput == s[j].val || kbinput == s[j].val - 32) {
|
||||||
|
|
||||||
|
@ -488,8 +487,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
||||||
inputbuf = nrealloc(inputbuf, inputlen + 2);
|
inputbuf = nrealloc(inputbuf, inputlen + 2);
|
||||||
|
|
||||||
memmove(&inputbuf[x - x_left + 1],
|
memmove(&inputbuf[x - x_left + 1],
|
||||||
&inputbuf[x - x_left],
|
&inputbuf[x - x_left], inputlen - (x - x_left) + 1);
|
||||||
inputlen - (x - x_left) + 1);
|
|
||||||
inputbuf[x - x_left] = kbinput;
|
inputbuf[x - x_left] = kbinput;
|
||||||
|
|
||||||
x++;
|
x++;
|
||||||
|
@ -553,9 +551,11 @@ void titlebar(char *path)
|
||||||
waddstr(topwin, &what[namelen - space]);
|
waddstr(topwin, &what[namelen - space]);
|
||||||
} else {
|
} else {
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1), _("File: "));
|
mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1),
|
||||||
|
_("File: "));
|
||||||
else
|
else
|
||||||
mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1), _(" DIR: "));
|
mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1),
|
||||||
|
_(" DIR: "));
|
||||||
waddstr(topwin, what);
|
waddstr(topwin, what);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,8 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
if (colorstrings != NULL)
|
if (colorstrings != NULL)
|
||||||
for (tmpcolor = colorstrings; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
|
for (tmpcolor = colorstrings; tmpcolor != NULL;
|
||||||
|
tmpcolor = tmpcolor->next) {
|
||||||
|
|
||||||
k = start;
|
k = start;
|
||||||
regcomp(&search_regexp, tmpcolor->start, 0);
|
regcomp(&search_regexp, tmpcolor->start, 0);
|
||||||
|
@ -807,7 +808,8 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||||
wattron(edit, COLOR_PAIR(tmpcolor->pairnum));
|
wattron(edit, COLOR_PAIR(tmpcolor->pairnum));
|
||||||
|
|
||||||
if (regmatches[0].rm_eo + k <= COLS)
|
if (regmatches[0].rm_eo + k <= COLS)
|
||||||
paintlen = regmatches[0].rm_eo - regmatches[0].rm_so;
|
paintlen =
|
||||||
|
regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||||
else
|
else
|
||||||
paintlen = COLS - k - regmatches[0].rm_so - 1;
|
paintlen = COLS - k - regmatches[0].rm_so - 1;
|
||||||
|
|
||||||
|
@ -888,7 +890,8 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||||
#endif /* ENABLE_COLOR */
|
#endif /* ENABLE_COLOR */
|
||||||
|
|
||||||
target =
|
target =
|
||||||
(virt_mark_beginx < COLS - 1) ? virt_mark_beginx : COLS - 1;
|
(virt_mark_beginx <
|
||||||
|
COLS - 1) ? virt_mark_beginx : COLS - 1;
|
||||||
|
|
||||||
mvwaddnstr(edit, yval, 0, fileptr->data, target);
|
mvwaddnstr(edit, yval, 0, fileptr->data, target);
|
||||||
|
|
||||||
|
@ -967,7 +970,8 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
||||||
this_page_end - virt_cur_x);
|
this_page_end - virt_cur_x);
|
||||||
else
|
else
|
||||||
mvwaddnstr(edit, yval, virt_cur_x,
|
mvwaddnstr(edit, yval, virt_cur_x,
|
||||||
&fileptr->data[virt_cur_x], COLS - virt_cur_x);
|
&fileptr->data[virt_cur_x],
|
||||||
|
COLS - virt_cur_x);
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
color_off(edit, COLOR_MARKER);
|
color_off(edit, COLOR_MARKER);
|
||||||
|
@ -1355,13 +1359,15 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
|
||||||
if (all) {
|
if (all) {
|
||||||
char yesnosquare[2][2] = {
|
char yesnosquare[2][2] = {
|
||||||
{yesstr[0], allstr[0]},
|
{yesstr[0], allstr[0]},
|
||||||
{nostr[0], NANO_CONTROL_C }};
|
{nostr[0], NANO_CONTROL_C}
|
||||||
|
};
|
||||||
|
|
||||||
ungetch(yesnosquare[mevent.y][mevent.x / (COLS / 6)]);
|
ungetch(yesnosquare[mevent.y][mevent.x / (COLS / 6)]);
|
||||||
} else {
|
} else {
|
||||||
char yesnosquare[2][2] = {
|
char yesnosquare[2][2] = {
|
||||||
{yesstr[0], '\0'},
|
{yesstr[0], '\0'},
|
||||||
{nostr[0], NANO_CONTROL_C }};
|
{nostr[0], NANO_CONTROL_C}
|
||||||
|
};
|
||||||
|
|
||||||
ungetch(yesnosquare[mevent.y][mevent.x / (COLS / 6)]);
|
ungetch(yesnosquare[mevent.y][mevent.x / (COLS / 6)]);
|
||||||
}
|
}
|
||||||
|
@ -1375,23 +1381,20 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Look for the kbinput in the yes, no and (optimally) all str */
|
/* Look for the kbinput in the yes, no and (optimally) all str */
|
||||||
for (i = 0; yesstr[i] != 0 && yesstr[i] != kbinput; i++)
|
for (i = 0; yesstr[i] != 0 && yesstr[i] != kbinput; i++);
|
||||||
;
|
|
||||||
if (yesstr[i] != 0) {
|
if (yesstr[i] != 0) {
|
||||||
ok = 1;
|
ok = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; nostr[i] != 0 && nostr[i] != kbinput; i++)
|
for (i = 0; nostr[i] != 0 && nostr[i] != kbinput; i++);
|
||||||
;
|
|
||||||
if (nostr[i] != 0) {
|
if (nostr[i] != 0) {
|
||||||
ok = 0;
|
ok = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all) {
|
if (all) {
|
||||||
for (i = 0; allstr[i] != 0 && allstr[i] != kbinput; i++)
|
for (i = 0; allstr[i] != 0 && allstr[i] != kbinput; i++);
|
||||||
;
|
|
||||||
if (allstr[i] != 0) {
|
if (allstr[i] != 0) {
|
||||||
ok = 2;
|
ok = 2;
|
||||||
break;
|
break;
|
||||||
|
@ -1518,7 +1521,8 @@ int do_cursorpos(int constant)
|
||||||
unconditionally; otherwise, only display the position when the
|
unconditionally; otherwise, only display the position when the
|
||||||
character values have changed */
|
character values have changed */
|
||||||
if (!constant || (old_i != i || old_totsize != totsize)) {
|
if (!constant || (old_i != i || old_totsize != totsize)) {
|
||||||
statusbar(_("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
|
statusbar(_
|
||||||
|
("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
|
||||||
current->lineno, totlines, linepct, i, totsize, bytepct);
|
current->lineno, totlines, linepct, i, totsize, bytepct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1660,8 +1664,7 @@ int do_help(void)
|
||||||
wrefresh(bottomwin);
|
wrefresh(bottomwin);
|
||||||
SET(NO_HELP);
|
SET(NO_HELP);
|
||||||
window_init();
|
window_init();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
bottombars(currshortcut, currslen);
|
bottombars(currshortcut, currslen);
|
||||||
|
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
|
@ -1727,7 +1730,8 @@ void do_replace_highlight(int highlight_flag, char *word)
|
||||||
char *highlight_word = NULL;
|
char *highlight_word = NULL;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
highlight_word = mallocstrcpy(highlight_word, ¤t->data[current_x]);
|
highlight_word =
|
||||||
|
mallocstrcpy(highlight_word, ¤t->data[current_x]);
|
||||||
highlight_word[strlen(word)] = '\0';
|
highlight_word[strlen(word)] = '\0';
|
||||||
|
|
||||||
/* adjust output when word extends beyond screen */
|
/* adjust output when word extends beyond screen */
|
||||||
|
@ -1767,7 +1771,8 @@ void do_credits(void)
|
||||||
char *brought = _("Brought to you by:");
|
char *brought = _("Brought to you by:");
|
||||||
char *specialthx = _("Special thanks to:");
|
char *specialthx = _("Special thanks to:");
|
||||||
char *fsf = _("The Free Software Foundation");
|
char *fsf = _("The Free Software Foundation");
|
||||||
char *ncurses = _("Pavel Curtis, Zeyd Ben-Halim and Eric S. Raymond for ncurses");
|
char *ncurses =
|
||||||
|
_("Pavel Curtis, Zeyd Ben-Halim and Eric S. Raymond for ncurses");
|
||||||
char *anyonelse = _("and anyone else we forgot...");
|
char *anyonelse = _("and anyone else we forgot...");
|
||||||
char *thankyou = _("Thank you for using nano!\n");
|
char *thankyou = _("Thank you for using nano!\n");
|
||||||
|
|
||||||
|
@ -1827,7 +1832,8 @@ void do_credits(void)
|
||||||
while (wgetch(edit) == ERR) {
|
while (wgetch(edit) == ERR) {
|
||||||
for (k = 0; k <= 1; k++) {
|
for (k = 0; k <= 1; k++) {
|
||||||
blank_edit();
|
blank_edit();
|
||||||
for (i = editwinrows / 2 - 1; i >= (editwinrows / 2 - 1 - j); i--) {
|
for (i = editwinrows / 2 - 1; i >= (editwinrows / 2 - 1 - j);
|
||||||
|
i--) {
|
||||||
mvwaddstr(edit, i * 2 - k, 0, hblank);
|
mvwaddstr(edit, i * 2 - k, 0, hblank);
|
||||||
|
|
||||||
if (place - (editwinrows / 2 - 1 - i) < CREDIT_LEN)
|
if (place - (editwinrows / 2 - 1 - i) < CREDIT_LEN)
|
||||||
|
@ -1873,6 +1879,3 @@ int keypad_on(WINDOW * win, int newval)
|
||||||
#endif /* HAVE_USEKEYPAD */
|
#endif /* HAVE_USEKEYPAD */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue