added an update_color, updated edit_add, i18ned a string and changed some getopt handlers in main to mallocstrcpy

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1203 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2002-05-05 23:03:54 +00:00
parent ca76fa9b39
commit 7c27be42d0
5 changed files with 36 additions and 12 deletions

View File

@ -24,7 +24,6 @@ CVS code -
syntaxfile_regexp and synfilematches. Global flag -Y ,--syntax syntaxfile_regexp and synfilematches. Global flag -Y ,--syntax
to specify the type on the command line, if there's no good to specify the type on the command line, if there's no good
filename regex to use. Global variable syntaxstr. filename regex to use. Global variable syntaxstr.
- Made some rc file errors less fatal.
- configure.ac: - configure.ac:
- Define NDEBUG to silence asserts (David Benbennick). - Define NDEBUG to silence asserts (David Benbennick).
- files.c: - files.c:
@ -40,6 +39,8 @@ CVS code -
- Optimizations (David Benbennick). - Optimizations (David Benbennick).
do_wrap() do_wrap()
- Complete rewrite (David Benbennick). - Complete rewrite (David Benbennick).
main()
- Changed charalloc(), strcpy()s to mallocstrcpy()s.
- nano.h: - nano.h:
- NANO_ALT_COMMAND and NANO_ALT_PERIOD were reversed (lol) - NANO_ALT_COMMAND and NANO_ALT_PERIOD were reversed (lol)
(David Benbennick). (David Benbennick).
@ -48,6 +49,11 @@ CVS code -
by default (Im an idiot). by default (Im an idiot).
- nano.1: - nano.1:
- Changed references to Debian GNU/Linux to Debian GNU (Jordi). - Changed references to Debian GNU/Linux to Debian GNU (Jordi).
- rcfile.c
- Made some rc file errors less fatal.
- winio.c:
edit_add()
- Changed some syntax hilight computations for the sake of COLS.
- po/gl.po: - po/gl.po:
- Galician translation updates (Jacobo Tarrio). - Galician translation updates (Jacobo Tarrio).
- po/de.po: - po/de.po:

View File

@ -102,6 +102,10 @@ void new_file(void)
UNSET(VIEW_MODE); UNSET(VIEW_MODE);
#endif #endif
#ifdef ENABLE_COLOR
update_color();
#endif
} }
filestruct *read_line(char *buf, filestruct * prev, int *line1ins) filestruct *read_line(char *buf, filestruct * prev, int *line1ins)

View File

@ -87,7 +87,7 @@ char *full_operating_dir = NULL;/* go higher than */
#endif #endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
char *alt_speller; /* Alternative spell command */ char *alt_speller = NULL; /* Alternative spell command */
#endif #endif
shortcut *main_list = NULL; shortcut *main_list = NULL;

6
nano.c
View File

@ -2959,8 +2959,7 @@ int main(int argc, char *argv[])
break; break;
#ifndef DISABLE_OPERATINGDIR #ifndef DISABLE_OPERATINGDIR
case 'o': case 'o':
operating_dir = charalloc(strlen(optarg) + 1); operating_dir = mallocstrcpy(operating_dir, optarg);
strcpy(operating_dir, optarg);
/* make sure we're inside the operating directory */ /* make sure we're inside the operating directory */
if (check_operating_dir(".", 0)) { if (check_operating_dir(".", 0)) {
@ -2991,8 +2990,7 @@ int main(int argc, char *argv[])
#endif #endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
case 's': case 's':
alt_speller = charalloc(strlen(optarg) + 1); alt_speller = mallocstrcpy(alt_speller, optarg);
strcpy(alt_speller, optarg);
break; break;
#endif #endif
case 't': case 't':

28
winio.c
View File

@ -803,7 +803,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
colormatches, 0)) { colormatches, 0)) {
if (colormatches[0].rm_eo - colormatches[0].rm_so < 1) { if (colormatches[0].rm_eo - colormatches[0].rm_so < 1) {
statusbar("Refusing 0 length regex match"); statusbar(_("Refusing 0 length regex match"));
break; break;
} }
#ifdef DEBUG #ifdef DEBUG
@ -816,11 +816,22 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
wattron(edit, A_BOLD); wattron(edit, A_BOLD);
wattron(edit, COLOR_PAIR(tmpcolor->pairnum)); wattron(edit, COLOR_PAIR(tmpcolor->pairnum));
if (colormatches[0].rm_eo + k <= COLS) if (colormatches[0].rm_eo + k <= COLS) {
paintlen = paintlen =
colormatches[0].rm_eo - colormatches[0].rm_so; colormatches[0].rm_eo - colormatches[0].rm_so;
else #ifdef DEBUG
fprintf(stderr, "paintlen (%d) = eo (%d) - so (%d)\n",
paintlen, colormatches[0].rm_eo, colormatches[0].rm_so);
#endif
}
else {
paintlen = COLS - k - colormatches[0].rm_so - 1; paintlen = COLS - k - colormatches[0].rm_so - 1;
#ifdef DEBUG
fprintf(stderr, "paintlen (%d) = COLS (%d) - k (%d), - rm.so (%d) - 1\n",
paintlen, COLS, k, colormatches[0].rm_so);
#endif
}
mvwaddnstr(edit, yval, colormatches[0].rm_so + k, mvwaddnstr(edit, yval, colormatches[0].rm_so + k,
&fileptr->data[k + colormatches[0].rm_so], &fileptr->data[k + colormatches[0].rm_so],
@ -902,18 +913,23 @@ 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 (s == fileptr && e == fileptr) if (s == fileptr && e == fileptr && ematch < COLS) {
mvwaddnstr(edit, yval, start + smatch, mvwaddnstr(edit, yval, start + smatch,
&fileptr->data[start + smatch], &fileptr->data[start + smatch],
ematch - smatch); ematch - smatch);
else if (s == fileptr) #ifdef DEBUG
fprintf(stderr, "start = %d, smatch = %d, ematch = %d\n", start,
smatch, ematch);
#endif
} else if (s == fileptr)
mvwaddnstr(edit, yval, start + smatch, mvwaddnstr(edit, yval, start + smatch,
&fileptr->data[start + smatch], &fileptr->data[start + smatch],
COLS - smatch); COLS - smatch);
else if (e == fileptr) else if (e == fileptr)
mvwaddnstr(edit, yval, start, mvwaddnstr(edit, yval, start,
&fileptr->data[start], &fileptr->data[start],
ematch - start); COLS - start);
else else
mvwaddnstr(edit, yval, start, mvwaddnstr(edit, yval, start,
&fileptr->data[start], &fileptr->data[start],