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
This commit is contained in:
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
to specify the type on the command line, if there's no good
filename regex to use. Global variable syntaxstr.
- Made some rc file errors less fatal.
- configure.ac:
- Define NDEBUG to silence asserts (David Benbennick).
- files.c:
@ -40,6 +39,8 @@ CVS code -
- Optimizations (David Benbennick).
do_wrap()
- Complete rewrite (David Benbennick).
main()
- Changed charalloc(), strcpy()s to mallocstrcpy()s.
- nano.h:
- NANO_ALT_COMMAND and NANO_ALT_PERIOD were reversed (lol)
(David Benbennick).
@ -48,6 +49,11 @@ CVS code -
by default (Im an idiot).
- nano.1:
- 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:
- Galician translation updates (Jacobo Tarrio).
- po/de.po:

View File

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

View File

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

6
nano.c
View File

@ -2959,8 +2959,7 @@ int main(int argc, char *argv[])
break;
#ifndef DISABLE_OPERATINGDIR
case 'o':
operating_dir = charalloc(strlen(optarg) + 1);
strcpy(operating_dir, optarg);
operating_dir = mallocstrcpy(operating_dir, optarg);
/* make sure we're inside the operating directory */
if (check_operating_dir(".", 0)) {
@ -2991,8 +2990,7 @@ int main(int argc, char *argv[])
#endif
#ifndef DISABLE_SPELLER
case 's':
alt_speller = charalloc(strlen(optarg) + 1);
strcpy(alt_speller, optarg);
alt_speller = mallocstrcpy(alt_speller, optarg);
break;
#endif
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)) {
if (colormatches[0].rm_eo - colormatches[0].rm_so < 1) {
statusbar("Refusing 0 length regex match");
statusbar(_("Refusing 0 length regex match"));
break;
}
#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, COLOR_PAIR(tmpcolor->pairnum));
if (colormatches[0].rm_eo + k <= COLS)
if (colormatches[0].rm_eo + k <= COLS) {
paintlen =
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;
#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,
&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));
if (s == fileptr && e == fileptr)
if (s == fileptr && e == fileptr && ematch < COLS) {
mvwaddnstr(edit, yval, start + smatch,
&fileptr->data[start + 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,
&fileptr->data[start + smatch],
COLS - smatch);
else if (e == fileptr)
mvwaddnstr(edit, yval, start,
&fileptr->data[start],
ematch - start);
COLS - start);
else
mvwaddnstr(edit, yval, start,
&fileptr->data[start],