mvwaddstr(bottomwin, 0, 0, buf);
waddnstr(bottomwin, inputbuf, wid);
wmove(bottomwin, 0, (x % COLS));
- }
- else {
+ } else {
/* Black magic */
buf[len - 1] = '$';
}
/* 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 kbinput = 0, j = 0, x = 0, xend;
#ifndef DISABLE_TABCOMP
int shift = 0;
#endif
-
+
inputbuf = charalloc(strlen(def) + 1);
inputbuf[0] = 0;
#ifndef DISABLE_HELP
/* Have to do this here, it would be too late to do it in statusq */
- if (kbinput == NANO_HELP_KEY
- || kbinput == NANO_HELP_FKEY) {
+ if (kbinput == NANO_HELP_KEY || kbinput == NANO_HELP_FKEY) {
do_help();
break;
}
switch (kbinput) {
- /* Stuff we want to equate with <enter>, ASCII 13 */
+ /* Stuff we want to equate with <enter>, ASCII 13 */
case 343:
ungetch(13); /* Enter on iris-ansi $TERM, sometimes */
break;
- /* Stuff we want to ignore */
+ /* Stuff we want to ignore */
#ifdef PDCURSES
case 541:
case 542:
- case 543: /* Right ctrl again */
+ case 543: /* Right ctrl again */
case 544:
- case 545: /* Right alt again */
+ case 545: /* Right alt again */
break;
#endif
#ifndef DISABLE_MOUSE
case NANO_CONTROL_I:
if (allowtabs) {
shift = 0;
- inputbuf = input_tab(inputbuf, (x - x_left),
- &tabbed, &shift, &list);
+ inputbuf = input_tab(inputbuf, (x - x_left),
+ &tabbed, &shift, &list);
x += shift;
if (x - x_left > strlen(inputbuf))
x = strlen(inputbuf) + x_left;
for (j = 0; j <= slen - 1; j++) {
#ifdef DEBUG
- fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput, kbinput);
+ fprintf(stderr, _("Aha! \'%c\' (%d)\n"), kbinput,
+ kbinput);
#endif
if (kbinput == s[j].val || kbinput == s[j].val - 32) {
inputlen = strlen(inputbuf);
inputbuf = nrealloc(inputbuf, inputlen + 2);
- memmove(&inputbuf[x - x_left + 1],
- &inputbuf[x - x_left],
- inputlen - (x - x_left) + 1);
+ memmove(&inputbuf[x - x_left + 1],
+ &inputbuf[x - x_left], inputlen - (x - x_left) + 1);
inputbuf[x - x_left] = kbinput;
x++;
free(inputbuf);
/* In pico mode, just check for a blank answer here */
- if (((ISSET(PICO_MODE)) && !strcmp(answer, "")))
+ if (((ISSET(PICO_MODE)) && !strcmp(answer, "")))
return -2;
else
return 0;
waddstr(topwin, &what[namelen - space]);
} else {
if (path == NULL)
- mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1), _("File: "));
+ mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1),
+ _("File: "));
else
- mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1), _(" DIR: "));
+ mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1),
+ _(" DIR: "));
waddstr(topwin, what);
}
}
if (ISSET(NO_HELP))
return;
-#ifdef ENABLE_COLOR
+#ifdef ENABLE_COLOR
color_on(bottomwin, COLOR_BOTTOMBARS);
if (!colors[COLOR_BOTTOMBARS - FIRST_COLORNUM].set ||
- colors[COLOR_BOTTOMBARS - FIRST_COLORNUM].fg != COLOR_BLACK)
- wattroff(bottomwin, A_REVERSE);
+ colors[COLOR_BOTTOMBARS - FIRST_COLORNUM].fg != COLOR_BLACK)
+ wattroff(bottomwin, A_REVERSE);
#endif
/* Determine how many extra spaces are needed to fill the bottom of the screen */
if (slen < 2)
k = COLS / 6 - 13;
else
- k = COLS / ((slen + (slen %2)) / 2) - 13;
+ k = COLS / ((slen + (slen % 2)) / 2) - 13;
clear_bottomwin();
waddch(bottomwin, ' ');
}
-#ifdef ENABLE_COLOR
+#ifdef ENABLE_COLOR
color_off(bottomwin, COLOR_BOTTOMBARS);
#endif
color_on(edit, COLOR_MARKER);
#else
wattron(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
mvwaddnstr(edit, y, begin - this_page_start,
&fileptr->data[begin], sel_data_len);
color_off(edit, COLOR_MARKER);
#else
wattroff(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
}
#endif
/* 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],
- get_page_end_virtual(this_page) - start + 1);
+ get_page_end_virtual(this_page) - start + 1);
#ifdef ENABLE_COLOR
if (colorstrings != NULL)
- for (tmpcolor = colorstrings; tmpcolor != NULL; tmpcolor = tmpcolor->next) {
+ for (tmpcolor = colorstrings; tmpcolor != NULL;
+ tmpcolor = tmpcolor->next) {
- k = start;
- regcomp(&search_regexp, tmpcolor->start, 0);
- while (!regexec(&search_regexp, &fileptr->data[k], 1,
- regmatches, 0)) {
+ k = start;
+ regcomp(&search_regexp, tmpcolor->start, 0);
+ while (!regexec(&search_regexp, &fileptr->data[k], 1,
+ regmatches, 0)) {
- if (regmatches[0].rm_eo - regmatches[0].rm_so < 1) {
- statusbar("Refusing 0 length regex match");
- break;
- }
+ if (regmatches[0].rm_eo - regmatches[0].rm_so < 1) {
+ statusbar("Refusing 0 length regex match");
+ break;
+ }
#ifdef DEBUG
- fprintf(stderr, "Match! (%d chars) \"%s\"\n",
+ fprintf(stderr, "Match! (%d chars) \"%s\"\n",
regmatches[0].rm_eo - regmatches[0].rm_so,
&fileptr->data[k + regmatches[0].rm_so]);
#endif
- if (regmatches[0].rm_so < COLS - 1) {
- if (tmpcolor->bright)
- wattron(edit, A_BOLD);
- wattron(edit, COLOR_PAIR(tmpcolor->pairnum));
+ if (regmatches[0].rm_so < COLS - 1) {
+ if (tmpcolor->bright)
+ wattron(edit, A_BOLD);
+ wattron(edit, COLOR_PAIR(tmpcolor->pairnum));
- if (regmatches[0].rm_eo + k <= COLS)
- paintlen = regmatches[0].rm_eo - regmatches[0].rm_so;
- else
- paintlen = COLS - k - regmatches[0].rm_so - 1;
+ if (regmatches[0].rm_eo + k <= COLS)
+ paintlen =
+ regmatches[0].rm_eo - regmatches[0].rm_so;
+ else
+ paintlen = COLS - k - regmatches[0].rm_so - 1;
- mvwaddnstr(edit, yval, regmatches[0].rm_so + k,
- &fileptr->data[k + regmatches[0].rm_so],
- paintlen);
+ mvwaddnstr(edit, yval, regmatches[0].rm_so + k,
+ &fileptr->data[k + regmatches[0].rm_so],
+ paintlen);
- }
+ }
- if (tmpcolor->bright)
- wattroff(edit, A_BOLD);
- wattroff(edit, COLOR_PAIR(tmpcolor->pairnum));
+ if (tmpcolor->bright)
+ wattroff(edit, A_BOLD);
+ 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
/* There are quite a few cases that could take place; we'll deal
* with them each in turn */
- if (ISSET(MARK_ISSET) &&
+ if (ISSET(MARK_ISSET) &&
!((fileptr->lineno > mark_beginbuf->lineno
- && fileptr->lineno > current->lineno)
- || (fileptr->lineno < mark_beginbuf->lineno
- && fileptr->lineno < current->lineno))) {
+ && fileptr->lineno > current->lineno)
+ || (fileptr->lineno < mark_beginbuf->lineno
+ && fileptr->lineno < current->lineno))) {
/* If we get here we are on a line that is at least
* partially selected. The lineno checks above determined
* that */
color_on(edit, COLOR_MARKER);
#else
wattron(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
mvwaddnstr(edit, yval, 0, fileptr->data, COLS);
color_off(edit, COLOR_MARKER);
#else
wattroff(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
} else if (fileptr == mark_beginbuf && fileptr == current) {
/* Special case, we're still on the same line we started
color_on(edit, COLOR_MARKER);
#else
wattron(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
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);
color_off(edit, COLOR_MARKER);
#else
wattroff(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
}
color_on(edit, COLOR_MARKER);
#else
wattron(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
target = (COLS - 1) - virt_mark_beginx;
target = 0;
mvwaddnstr(edit, yval, virt_mark_beginx,
- &fileptr->data[virt_mark_beginx], target);
+ &fileptr->data[virt_mark_beginx], target);
#ifdef ENABLE_COLOR
color_off(edit, COLOR_MARKER);
#else
wattroff(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
}
color_on(edit, COLOR_MARKER);
#else
wattron(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
if (virt_cur_x > COLS - 2) {
mvwaddnstr(edit, yval, 0,
- &fileptr->data[this_page_start],
- virt_cur_x - this_page_start);
+ &fileptr->data[this_page_start],
+ virt_cur_x - this_page_start);
} else
mvwaddnstr(edit, yval, 0, fileptr->data, virt_cur_x);
color_off(edit, COLOR_MARKER);
#else
wattroff(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
}
color_on(edit, COLOR_MARKER);
#else
wattron(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
if (virt_cur_x > COLS - 2)
mvwaddnstr(edit, yval, virt_cur_x - this_page_start,
- &fileptr->data[virt_cur_x],
- this_page_end - virt_cur_x);
+ &fileptr->data[virt_cur_x],
+ this_page_end - virt_cur_x);
else
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
color_off(edit, COLOR_MARKER);
#else
wattroff(edit, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
}
}
editbot = temp;
/* What the hell are we expecting to update the screen if this isn't
- here? luck?? */
+ here? luck?? */
wrefresh(edit);
}
/* Yes, no and all are strings of any length. Each string consists of
- all characters accepted as a valid character for that value.
- The first value will be the one displayed in the shortcuts. */
+ all characters accepted as a valid character for that value.
+ The first value will be the one displayed in the shortcuts. */
yesstr = _("Yy");
nostr = _("Nn");
allstr = _("Aa");
color_on(bottomwin, COLOR_STATUSBAR);
#else
wattron(bottomwin, A_REVERSE);
-#endif /* ENABLE_COLOR */
+#endif /* ENABLE_COLOR */
blank_statusbar();
mvwaddstr(bottomwin, 0, 0, foo);
of possible return keystrokes based on the x and y values */
if (all) {
char yesnosquare[2][2] = {
- {yesstr[0], allstr[0]},
- {nostr[0], NANO_CONTROL_C }};
+ {yesstr[0], allstr[0]},
+ {nostr[0], NANO_CONTROL_C}
+ };
- ungetch(yesnosquare[mevent.y][mevent.x/(COLS/6)]);
+ ungetch(yesnosquare[mevent.y][mevent.x / (COLS / 6)]);
} else {
char yesnosquare[2][2] = {
{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;
default:
/* 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) {
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) {
ok = 0;
- break;
+ break;
}
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) {
ok = 2;
- break;
+ break;
}
}
}
unconditionally; otherwise, only display the position when the
character values have changed */
if (!constant || (old_i != i || old_totsize != totsize)) {
- statusbar(_("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
- current->lineno, totlines, linepct, i, totsize, bytepct);
+ statusbar(_
+ ("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
+ current->lineno, totlines, linepct, i, totsize, bytepct);
}
old_i = i;
switch (kbinput) {
#ifndef DISABLE_MOUSE
#ifdef NCURSES_MOUSE_VERSION
- case KEY_MOUSE:
- do_mouse();
- break;
+ case KEY_MOUSE:
+ do_mouse();
+ break;
#endif
#endif
case NANO_NEXTPAGE_KEY:
no_more = 1;
continue;
}
- } while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY &&
- kbinput != NANO_EXIT_FKEY);
+ } while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY &&
+ kbinput != NANO_EXIT_FKEY);
currshortcut = oldshortcut;
currslen = oldslen;
wrefresh(bottomwin);
SET(NO_HELP);
window_init();
- }
- else
+ } else
bottombars(currshortcut, currslen);
curs_set(1);
char *highlight_word = NULL;
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';
/* adjust output when word extends beyond screen */
/* OK display the output */
reset_cursor();
-
+
if (highlight_flag)
wattron(edit, A_REVERSE);
char *brought = _("Brought to you by:");
char *specialthx = _("Special thanks to:");
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 *thankyou = _("Thank you for using nano!\n");
- char *credits[CREDIT_LEN] = {nanotext,
- version,
- VERSION,
- "",
- brought,
- "Chris Allegretta",
- "Jordi Mallach",
- "Adam Rogoyski",
- "Rob Siemborski",
- "Rocco Corsi",
- "Ken Tyler",
- "Sven Guckes",
- "Florian König",
- "Pauli Virtanen",
- "Daniele Medri",
- "Clement Laforet",
- "Tedi Heriyanto",
- "Bill Soudan",
- "Christian Weisgerber",
- "Erik Andersen",
- "Big Gaute",
- "Joshua Jensen",
- "Ryan Krebs",
- "Albert Chin",
- "David Lawrence Ramsey",
- "",
- specialthx,
- "Plattsburgh State University",
- "Benet Laboratories",
- "Amy Allegretta",
- "Linda Young",
- "Jeremy Robichaud",
- "Richard Kolb II",
- fsf,
- "Linus Torvalds",
- ncurses,
- anyonelse,
- thankyou,
- "", "", "", "",
- "(c) 1999-2002 Chris Allegretta",
- "", "", "", "",
- "www.nano-editor.org"
+ char *credits[CREDIT_LEN] = { nanotext,
+ version,
+ VERSION,
+ "",
+ brought,
+ "Chris Allegretta",
+ "Jordi Mallach",
+ "Adam Rogoyski",
+ "Rob Siemborski",
+ "Rocco Corsi",
+ "Ken Tyler",
+ "Sven Guckes",
+ "Florian König",
+ "Pauli Virtanen",
+ "Daniele Medri",
+ "Clement Laforet",
+ "Tedi Heriyanto",
+ "Bill Soudan",
+ "Christian Weisgerber",
+ "Erik Andersen",
+ "Big Gaute",
+ "Joshua Jensen",
+ "Ryan Krebs",
+ "Albert Chin",
+ "David Lawrence Ramsey",
+ "",
+ specialthx,
+ "Plattsburgh State University",
+ "Benet Laboratories",
+ "Amy Allegretta",
+ "Linda Young",
+ "Jeremy Robichaud",
+ "Richard Kolb II",
+ fsf,
+ "Linus Torvalds",
+ ncurses,
+ anyonelse,
+ thankyou,
+ "", "", "", "",
+ "(c) 1999-2002 Chris Allegretta",
+ "", "", "", "",
+ "www.nano-editor.org"
};
curs_set(0);
while (wgetch(edit) == ERR) {
for (k = 0; k <= 1; k++) {
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);
if (place - (editwinrows / 2 - 1 - i) < CREDIT_LEN)
curs_set(1);
display_main_list();
total_refresh();
- }
+}
#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. */
#ifdef HAVE_USEKEYPAD
- int old;
+ int old;
old = win->_use_keypad;
keypad(win, newval);
#else
keypad(win, newval);
return 1;
-#endif /* HAVE_USEKEYPAD */
+#endif /* HAVE_USEKEYPAD */
}
-
-
-