Commit 598106e5 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

re-indent winio.c

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1020 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 69bba322
Showing with 159 additions and 156 deletions
+159 -156
...@@ -241,8 +241,7 @@ void nanoget_repaint(char *buf, char *inputbuf, int x) ...@@ -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] = '$';
...@@ -259,7 +258,7 @@ void nanoget_repaint(char *buf, char *inputbuf, int x) ...@@ -259,7 +258,7 @@ void nanoget_repaint(char *buf, char *inputbuf, int x)
} }
/* Get the input from the kb; this should only be called from statusq */ /* Get the input from the kb; this should only be called from statusq */
int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen, int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
int start_x, int list) int start_x, int list)
{ {
int kbinput = 0, j = 0, x = 0, xend; int kbinput = 0, j = 0, x = 0, xend;
...@@ -268,7 +267,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen, ...@@ -268,7 +267,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
#ifndef DISABLE_TABCOMP #ifndef DISABLE_TABCOMP
int shift = 0; int shift = 0;
#endif #endif
inputbuf = charalloc(strlen(def) + 1); inputbuf = charalloc(strlen(def) + 1);
inputbuf[0] = 0; inputbuf[0] = 0;
...@@ -299,8 +298,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen, ...@@ -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;
} }
...@@ -320,17 +318,17 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen, ...@@ -320,17 +318,17 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
switch (kbinput) { switch (kbinput) {
/* Stuff we want to equate with <enter>, ASCII 13 */ /* Stuff we want to equate with <enter>, ASCII 13 */
case 343: case 343:
ungetch(13); /* Enter on iris-ansi $TERM, sometimes */ ungetch(13); /* Enter on iris-ansi $TERM, sometimes */
break; break;
/* Stuff we want to ignore */ /* Stuff we want to ignore */
#ifdef PDCURSES #ifdef PDCURSES
case 541: case 541:
case 542: case 542:
case 543: /* Right ctrl again */ case 543: /* Right ctrl again */
case 544: case 544:
case 545: /* Right alt again */ case 545: /* Right alt again */
break; break;
#endif #endif
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
...@@ -388,8 +386,8 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen, ...@@ -388,8 +386,8 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
case NANO_CONTROL_I: case NANO_CONTROL_I:
if (allowtabs) { if (allowtabs) {
shift = 0; shift = 0;
inputbuf = input_tab(inputbuf, (x - x_left), inputbuf = input_tab(inputbuf, (x - x_left),
&tabbed, &shift, &list); &tabbed, &shift, &list);
x += shift; x += shift;
if (x - x_left > strlen(inputbuf)) if (x - x_left > strlen(inputbuf))
x = strlen(inputbuf) + x_left; x = strlen(inputbuf) + x_left;
...@@ -463,7 +461,8 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen, ...@@ -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) {
...@@ -487,9 +486,8 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen, ...@@ -487,9 +486,8 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
inputlen = strlen(inputbuf); inputlen = strlen(inputbuf);
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++;
...@@ -506,7 +504,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen, ...@@ -506,7 +504,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
free(inputbuf); free(inputbuf);
/* In pico mode, just check for a blank answer here */ /* In pico mode, just check for a blank answer here */
if (((ISSET(PICO_MODE)) && !strcmp(answer, ""))) if (((ISSET(PICO_MODE)) && !strcmp(answer, "")))
return -2; return -2;
else else
return 0; return 0;
...@@ -553,9 +551,11 @@ void titlebar(char *path) ...@@ -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);
} }
} }
...@@ -601,18 +601,18 @@ void bottombars(shortcut s[], int slen) ...@@ -601,18 +601,18 @@ void bottombars(shortcut s[], int slen)
if (ISSET(NO_HELP)) if (ISSET(NO_HELP))
return; return;
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
color_on(bottomwin, COLOR_BOTTOMBARS); color_on(bottomwin, COLOR_BOTTOMBARS);
if (!colors[COLOR_BOTTOMBARS - FIRST_COLORNUM].set || if (!colors[COLOR_BOTTOMBARS - FIRST_COLORNUM].set ||
colors[COLOR_BOTTOMBARS - FIRST_COLORNUM].fg != COLOR_BLACK) colors[COLOR_BOTTOMBARS - FIRST_COLORNUM].fg != COLOR_BLACK)
wattroff(bottomwin, A_REVERSE); wattroff(bottomwin, A_REVERSE);
#endif #endif
/* Determine how many extra spaces are needed to fill the bottom of the screen */ /* Determine how many extra spaces are needed to fill the bottom of the screen */
if (slen < 2) if (slen < 2)
k = COLS / 6 - 13; k = COLS / 6 - 13;
else else
k = COLS / ((slen + (slen %2)) / 2) - 13; k = COLS / ((slen + (slen % 2)) / 2) - 13;
clear_bottomwin(); clear_bottomwin();
...@@ -645,7 +645,7 @@ void bottombars(shortcut s[], int slen) ...@@ -645,7 +645,7 @@ void bottombars(shortcut s[], int slen)
waddch(bottomwin, ' '); waddch(bottomwin, ' ');
} }
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
color_off(bottomwin, COLOR_BOTTOMBARS); color_off(bottomwin, COLOR_BOTTOMBARS);
#endif #endif
...@@ -748,7 +748,7 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y, ...@@ -748,7 +748,7 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
color_on(edit, COLOR_MARKER); color_on(edit, COLOR_MARKER);
#else #else
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
mvwaddnstr(edit, y, begin - this_page_start, mvwaddnstr(edit, y, begin - this_page_start,
&fileptr->data[begin], sel_data_len); &fileptr->data[begin], sel_data_len);
...@@ -757,7 +757,7 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y, ...@@ -757,7 +757,7 @@ void add_marked_sameline(int begin, int end, filestruct * fileptr, int y,
color_off(edit, COLOR_MARKER); color_off(edit, COLOR_MARKER);
#else #else
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
} }
#endif #endif
...@@ -779,62 +779,64 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -779,62 +779,64 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
/* Just paint the string in any case (we'll add color or reverse on /* Just paint the string in any case (we'll add color or reverse on
just the text that needs it */ just the text that needs it */
mvwaddnstr(edit, yval, 0, &fileptr->data[start], mvwaddnstr(edit, yval, 0, &fileptr->data[start],
get_page_end_virtual(this_page) - start + 1); get_page_end_virtual(this_page) - start + 1);
#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);
while (!regexec(&search_regexp, &fileptr->data[k], 1, while (!regexec(&search_regexp, &fileptr->data[k], 1,
regmatches, 0)) { regmatches, 0)) {
if (regmatches[0].rm_eo - regmatches[0].rm_so < 1) { if (regmatches[0].rm_eo - regmatches[0].rm_so < 1) {
statusbar("Refusing 0 length regex match"); statusbar("Refusing 0 length regex match");
break; break;
} }
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Match! (%d chars) \"%s\"\n", fprintf(stderr, "Match! (%d chars) \"%s\"\n",
regmatches[0].rm_eo - regmatches[0].rm_so, regmatches[0].rm_eo - regmatches[0].rm_so,
&fileptr->data[k + regmatches[0].rm_so]); &fileptr->data[k + regmatches[0].rm_so]);
#endif #endif
if (regmatches[0].rm_so < COLS - 1) { if (regmatches[0].rm_so < COLS - 1) {
if (tmpcolor->bright) if (tmpcolor->bright)
wattron(edit, A_BOLD); wattron(edit, A_BOLD);
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 =
else regmatches[0].rm_eo - regmatches[0].rm_so;
paintlen = COLS - k - regmatches[0].rm_so - 1; else
paintlen = COLS - k - regmatches[0].rm_so - 1;
mvwaddnstr(edit, yval, regmatches[0].rm_so + k, mvwaddnstr(edit, yval, regmatches[0].rm_so + k,
&fileptr->data[k + regmatches[0].rm_so], &fileptr->data[k + regmatches[0].rm_so],
paintlen); paintlen);
} }
if (tmpcolor->bright) if (tmpcolor->bright)
wattroff(edit, A_BOLD); wattroff(edit, A_BOLD);
wattroff(edit, COLOR_PAIR(tmpcolor->pairnum)); wattroff(edit, COLOR_PAIR(tmpcolor->pairnum));
k += regmatches[0].rm_eo; k += regmatches[0].rm_eo;
} }
} }
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* There are quite a few cases that could take place; we'll deal /* There are quite a few cases that could take place; we'll deal
* with them each in turn */ * with them each in turn */
if (ISSET(MARK_ISSET) && if (ISSET(MARK_ISSET) &&
!((fileptr->lineno > mark_beginbuf->lineno !((fileptr->lineno > mark_beginbuf->lineno
&& fileptr->lineno > current->lineno) && fileptr->lineno > current->lineno)
|| (fileptr->lineno < mark_beginbuf->lineno || (fileptr->lineno < mark_beginbuf->lineno
&& fileptr->lineno < current->lineno))) { && fileptr->lineno < current->lineno))) {
/* If we get here we are on a line that is at least /* If we get here we are on a line that is at least
* partially selected. The lineno checks above determined * partially selected. The lineno checks above determined
* that */ * that */
...@@ -845,7 +847,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -845,7 +847,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
color_on(edit, COLOR_MARKER); color_on(edit, COLOR_MARKER);
#else #else
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
mvwaddnstr(edit, yval, 0, fileptr->data, COLS); mvwaddnstr(edit, yval, 0, fileptr->data, COLS);
...@@ -853,7 +855,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -853,7 +855,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
color_off(edit, COLOR_MARKER); color_off(edit, COLOR_MARKER);
#else #else
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
} else if (fileptr == mark_beginbuf && fileptr == current) { } else if (fileptr == mark_beginbuf && fileptr == current) {
/* Special case, we're still on the same line we started /* Special case, we're still on the same line we started
...@@ -885,10 +887,11 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -885,10 +887,11 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
color_on(edit, COLOR_MARKER); color_on(edit, COLOR_MARKER);
#else #else
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
#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);
...@@ -896,7 +899,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -896,7 +899,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
color_off(edit, COLOR_MARKER); color_off(edit, COLOR_MARKER);
#else #else
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
} }
...@@ -906,7 +909,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -906,7 +909,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
color_on(edit, COLOR_MARKER); color_on(edit, COLOR_MARKER);
#else #else
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
target = (COLS - 1) - virt_mark_beginx; target = (COLS - 1) - virt_mark_beginx;
...@@ -914,13 +917,13 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -914,13 +917,13 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
target = 0; target = 0;
mvwaddnstr(edit, yval, virt_mark_beginx, mvwaddnstr(edit, yval, virt_mark_beginx,
&fileptr->data[virt_mark_beginx], target); &fileptr->data[virt_mark_beginx], target);
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
color_off(edit, COLOR_MARKER); color_off(edit, COLOR_MARKER);
#else #else
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
} }
...@@ -936,12 +939,12 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -936,12 +939,12 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
color_on(edit, COLOR_MARKER); color_on(edit, COLOR_MARKER);
#else #else
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
if (virt_cur_x > COLS - 2) { if (virt_cur_x > COLS - 2) {
mvwaddnstr(edit, yval, 0, mvwaddnstr(edit, yval, 0,
&fileptr->data[this_page_start], &fileptr->data[this_page_start],
virt_cur_x - this_page_start); virt_cur_x - this_page_start);
} else } else
mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x); mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x);
...@@ -949,7 +952,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -949,7 +952,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
color_off(edit, COLOR_MARKER); color_off(edit, COLOR_MARKER);
#else #else
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
} }
...@@ -959,21 +962,22 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x, ...@@ -959,21 +962,22 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
color_on(edit, COLOR_MARKER); color_on(edit, COLOR_MARKER);
#else #else
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
if (virt_cur_x > COLS - 2) if (virt_cur_x > COLS - 2)
mvwaddnstr(edit, yval, virt_cur_x - this_page_start, mvwaddnstr(edit, yval, virt_cur_x - this_page_start,
&fileptr->data[virt_cur_x], &fileptr->data[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);
#else #else
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
} }
} }
...@@ -1113,7 +1117,7 @@ void edit_refresh(void) ...@@ -1113,7 +1117,7 @@ void edit_refresh(void)
editbot = temp; editbot = temp;
/* What the hell are we expecting to update the screen if this isn't /* What the hell are we expecting to update the screen if this isn't
here? luck?? */ here? luck?? */
wrefresh(edit); wrefresh(edit);
} }
...@@ -1276,8 +1280,8 @@ int do_yesno(int all, int leavecursor, char *msg, ...) ...@@ -1276,8 +1280,8 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
/* Yes, no and all are strings of any length. Each string consists of /* Yes, no and all are strings of any length. Each string consists of
all characters accepted as a valid character for that value. all characters accepted as a valid character for that value.
The first value will be the one displayed in the shortcuts. */ The first value will be the one displayed in the shortcuts. */
yesstr = _("Yy"); yesstr = _("Yy");
nostr = _("Nn"); nostr = _("Nn");
allstr = _("Aa"); allstr = _("Aa");
...@@ -1316,7 +1320,7 @@ int do_yesno(int all, int leavecursor, char *msg, ...) ...@@ -1316,7 +1320,7 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
color_on(bottomwin, COLOR_STATUSBAR); color_on(bottomwin, COLOR_STATUSBAR);
#else #else
wattron(bottomwin, A_REVERSE); wattron(bottomwin, A_REVERSE);
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
blank_statusbar(); blank_statusbar();
mvwaddstr(bottomwin, 0, 0, foo); mvwaddstr(bottomwin, 0, 0, foo);
...@@ -1354,16 +1358,18 @@ int do_yesno(int all, int leavecursor, char *msg, ...) ...@@ -1354,16 +1358,18 @@ int do_yesno(int all, int leavecursor, char *msg, ...)
of possible return keystrokes based on the x and y values */ of possible return keystrokes based on the x and y values */
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)]);
} }
} }
break; break;
...@@ -1375,26 +1381,23 @@ int do_yesno(int all, int leavecursor, char *msg, ...) ...@@ -1375,26 +1381,23 @@ 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,8 +1521,9 @@ int do_cursorpos(int constant) ...@@ -1518,8 +1521,9 @@ 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(_
current->lineno, totlines, linepct, i, totsize, bytepct); ("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
current->lineno, totlines, linepct, i, totsize, bytepct);
} }
old_i = i; old_i = i;
...@@ -1579,9 +1583,9 @@ int do_help(void) ...@@ -1579,9 +1583,9 @@ int do_help(void)
switch (kbinput) { switch (kbinput) {
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
#ifdef NCURSES_MOUSE_VERSION #ifdef NCURSES_MOUSE_VERSION
case KEY_MOUSE: case KEY_MOUSE:
do_mouse(); do_mouse();
break; break;
#endif #endif
#endif #endif
case NANO_NEXTPAGE_KEY: case NANO_NEXTPAGE_KEY:
...@@ -1649,8 +1653,8 @@ int do_help(void) ...@@ -1649,8 +1653,8 @@ int do_help(void)
no_more = 1; no_more = 1;
continue; continue;
} }
} while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY && } while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY &&
kbinput != NANO_EXIT_FKEY); kbinput != NANO_EXIT_FKEY);
currshortcut = oldshortcut; currshortcut = oldshortcut;
currslen = oldslen; currslen = oldslen;
...@@ -1660,8 +1664,7 @@ int do_help(void) ...@@ -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) ...@@ -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, &current->data[current_x]); highlight_word =
mallocstrcpy(highlight_word, &current->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 */
...@@ -1743,7 +1747,7 @@ void do_replace_highlight(int highlight_flag, char *word) ...@@ -1743,7 +1747,7 @@ void do_replace_highlight(int highlight_flag, char *word)
/* OK display the output */ /* OK display the output */
reset_cursor(); reset_cursor();
if (highlight_flag) if (highlight_flag)
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
...@@ -1767,52 +1771,53 @@ void do_credits(void) ...@@ -1767,52 +1771,53 @@ 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");
char *credits[CREDIT_LEN] = {nanotext, char *credits[CREDIT_LEN] = { nanotext,
version, version,
VERSION, VERSION,
"", "",
brought, brought,
"Chris Allegretta", "Chris Allegretta",
"Jordi Mallach", "Jordi Mallach",
"Adam Rogoyski", "Adam Rogoyski",
"Rob Siemborski", "Rob Siemborski",
"Rocco Corsi", "Rocco Corsi",
"Ken Tyler", "Ken Tyler",
"Sven Guckes", "Sven Guckes",
"Florian Knig", "Florian Knig",
"Pauli Virtanen", "Pauli Virtanen",
"Daniele Medri", "Daniele Medri",
"Clement Laforet", "Clement Laforet",
"Tedi Heriyanto", "Tedi Heriyanto",
"Bill Soudan", "Bill Soudan",
"Christian Weisgerber", "Christian Weisgerber",
"Erik Andersen", "Erik Andersen",
"Big Gaute", "Big Gaute",
"Joshua Jensen", "Joshua Jensen",
"Ryan Krebs", "Ryan Krebs",
"Albert Chin", "Albert Chin",
"David Lawrence Ramsey", "David Lawrence Ramsey",
"", "",
specialthx, specialthx,
"Plattsburgh State University", "Plattsburgh State University",
"Benet Laboratories", "Benet Laboratories",
"Amy Allegretta", "Amy Allegretta",
"Linda Young", "Linda Young",
"Jeremy Robichaud", "Jeremy Robichaud",
"Richard Kolb II", "Richard Kolb II",
fsf, fsf,
"Linus Torvalds", "Linus Torvalds",
ncurses, ncurses,
anyonelse, anyonelse,
thankyou, thankyou,
"", "", "", "", "", "", "", "",
"(c) 1999-2002 Chris Allegretta", "(c) 1999-2002 Chris Allegretta",
"", "", "", "", "", "", "", "",
"www.nano-editor.org" "www.nano-editor.org"
}; };
curs_set(0); curs_set(0);
...@@ -1827,7 +1832,8 @@ void do_credits(void) ...@@ -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)
...@@ -1854,15 +1860,15 @@ void do_credits(void) ...@@ -1854,15 +1860,15 @@ void do_credits(void)
curs_set(1); curs_set(1);
display_main_list(); display_main_list();
total_refresh(); total_refresh();
} }
#endif #endif
int keypad_on(WINDOW * win, int newval) int keypad_on(WINDOW * win, int newval)
{ {
/* This is taken right from aumix. Don't sue me. */ /* This is taken right from aumix. Don't sue me. */
#ifdef HAVE_USEKEYPAD #ifdef HAVE_USEKEYPAD
int old; int old;
old = win->_use_keypad; old = win->_use_keypad;
keypad(win, newval); keypad(win, newval);
...@@ -1870,9 +1876,6 @@ int keypad_on(WINDOW * win, int newval) ...@@ -1870,9 +1876,6 @@ int keypad_on(WINDOW * win, int newval)
#else #else
keypad(win, newval); keypad(win, newval);
return 1; return 1;
#endif /* HAVE_USEKEYPAD */ #endif /* HAVE_USEKEYPAD */
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment