]> git.wh0rd.org Git - nano.git/commitdiff
added an update_color, updated edit_add, i18ned a string and changed some getopt...
authorChris Allegretta <chrisa@asty.org>
Sun, 5 May 2002 23:03:54 +0000 (23:03 +0000)
committerChris Allegretta <chrisa@asty.org>
Sun, 5 May 2002 23:03:54 +0000 (23:03 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1203 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
files.c
global.c
nano.c
winio.c

index 2a70b9ce3ac2ae1adde229c0958ced7933fafe5a..9c85d4660653454d3590fdc530159650c0b53f1c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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:
diff --git a/files.c b/files.c
index 9f864c874eb4bd5b692a7167790e29152810dd2d..9e52548cde79ec2993e8eda7ecfd5d24926d5293 100644 (file)
--- a/files.c
+++ b/files.c
@@ -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)
index b64f67a51849b45ae7b840e81f7d66f16b62ca5d..b32990fb313985931a3da7ddaf2dbf02133470c9 100644 (file)
--- a/global.c
+++ b/global.c
@@ -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;
diff --git a/nano.c b/nano.c
index de74b842c062bc6d195d4506f9d920bfc9aca049..73bf5f60b6eb1f78e857faa2394bd9ed44d2eba2 100644 (file)
--- a/nano.c
+++ b/nano.c
@@ -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':
diff --git a/winio.c b/winio.c
index 796f4b2ba14095efb07ccdb44b960d46e474c12f..6883d23c1d52bd604f82952505e5b01a3f99860a 100644 (file)
--- a/winio.c
+++ b/winio.c
@@ -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],