nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] patch update


From: David Lawrence Ramsey
Subject: [Nano-devel] patch update
Date: Fri, 17 May 2002 11:50:07 -0700 (PDT)

Changes from last time:

* reverted the extra sanity checks from last time; the ones
in do_down() and do_up() aren't needed since actual_x()'s
return value doesn't go out of range, and the value of the
ones in do_delete() and do_backspace() is questionable,
since I'm still not sure what caused that segfault yesterday

* removed an unneeded blank line from nanorc.sample

* i18nized some debugging strings

* fixed the check for binary characters when reading in a
file; if only delete characters were found, it wouldn't
detect the file as binary

* fixed update_line() so that marking works properly on a
line containing control characters (i. e. the highlight is
no longer off by one for each of them encountered)

* fixed a minor problem where appending/prepending file A to
file B would change file A's name to file B's name
afterward, even though file A is not changed

* found a strange bug in the null handling code that I
haven't yet been able to pin down; sometimes nano stops
before reading an entire binary file in, and there doesn't
seem to be any pattern to it except that the offending
binary files have all been ELF executables

* readded the fixes to actual_x_from_start() to make it
account for control characters when moving up/down; it
turns out that pico does do this (I was accidentally
running a pico->nano symlink when I thought otherwise)

Note: I put an extra fix in it to prevent it from being
high-by-one in some cases, but it doesn't handle all
cases, and right now I am stumped as to how to handle all
cases; some of the things I've tried have been:

    * in move.c, recalculating placewewant just before
calling actual_x() with it
    * various other hacks to actual_x_from_start(); the
fix I have in it already doesn't account for when tot
and xplus are equal, and I can't check for just that
because there are legitimate cases of it
    * only calling actual_x() when the next/previous line
is greater in length than the current line; this doesn't
account for tabs, and shifts the cursor backward each
time it's moved to a shorter line

If anyone has any ideas as to how to get this to work
properly, please let me know.  (Additional note: If you
want to compare nano's behavior with pico's in this case,
be sure to use a binary file that doesn't contain any
nulls or delete characters when doing so.)


_____________________________________________________________
Sluggy.Net: The Sluggy Freelance Community!

_____________________________________________________________
Promote your group and strengthen ties to your members with address@hidden by 
Everyone.net  http://www.everyone.net/?btn=tag
diff -urN nano-1.1.9-cvs/color.c nano-1.1.9-cvs-fixed/color.c
--- nano-1.1.9-cvs/color.c      Sun May 12 16:54:16 2002
+++ nano-1.1.9-cvs-fixed/color.c        Fri May 17 13:54:29 2002
@@ -135,7 +135,7 @@
                init_pair(i, tmpcolor->fg, tmpcolor->bg);
 
 #ifdef DEBUG
-           fprintf(stderr, "Running init_pair with fg = %d and bg = %d\n", 
tmpcolor->fg, tmpcolor->bg);
+           fprintf(stderr, _("Running init_pair with fg = %d and bg = %d\n"), 
tmpcolor->fg, tmpcolor->bg);
 #endif
 
            tmpcolor->pairnum = i;
diff -urN nano-1.1.9-cvs/faq.html nano-1.1.9-cvs-fixed/faq.html
--- nano-1.1.9-cvs/faq.html     Sun May 12 20:09:30 2002
+++ nano-1.1.9-cvs-fixed/faq.html       Fri May 17 13:54:29 2002
@@ -342,7 +342,7 @@
 'gettext' and/or 'gettextdomain'.&nbsp; What can I do about it?</font></h2>
 
 <blockquote><font color="#330000">Try doing a <b>./configure 
--with-included-gettext</b>
-and see if that solves your problem.&nbsp; You make need to do a <b>make
+and see if that solves your problem.&nbsp; You may need to do a <b>make
 clean ; make</b> to get it to work fully.</font></blockquote>
 
 <h2>
diff -urN nano-1.1.9-cvs/files.c nano-1.1.9-cvs-fixed/files.c
--- nano-1.1.9-cvs/files.c      Sun May 12 15:52:15 2002
+++ nano-1.1.9-cvs-fixed/files.c        Fri May 17 13:54:29 2002
@@ -108,11 +108,15 @@
 
 }
 
-filestruct *read_line(char *buf, filestruct *prev, int *line1ins)
+filestruct *read_line(char *buf, filestruct *prev, int *line1ins, int len)
 {
     filestruct *fileptr;
 
     fileptr = nmalloc(sizeof(filestruct));
+
+    /* nulls to newlines; len is the string's real length here */
+    unsunder(buf, len);
+
     fileptr->data = charalloc(strlen(buf) + 2);
     strcpy(fileptr->data, buf);
 
@@ -158,7 +162,7 @@
 
 int read_file(FILE *f, const char *filename, int quiet)
 {
-    int num_lines = 0;
+    int num_lines = 0, len = 0;
     signed char input;         /* current input character */
     char *buf;
     long i = 0, bufx = 128;
@@ -179,28 +183,51 @@
     }
     /* Read the entire file into file struct */
     while ((input_int = getc(f)) != EOF) {
-        input = (char) input_int;
+        input = (signed char) input_int;
 #ifndef NANO_SMALL
-       if (!ISSET(NO_CONVERT) && input >= 0 && input <= 31
-               && input != 127 && input != '\t' && input != '\r'
-               && input != '\n')
+       if (!ISSET(NO_CONVERT) && ((input >= 0 && input <= 31
+               && input != '\t' && input != '\r' && input != '\n')
+               || input == 127))
        /* If the file has binary chars in it, don't stupidly
           assume it's a DOS or Mac formatted file! */
        SET(NO_CONVERT);
 #endif
 
+       /* calculate the total length of the line; it might have nulls in
+          it, so we can't just use strlen() */
+       len++;
+
        if (input == '\n') {
-           fileptr = read_line(buf, fileptr, &line1ins);
+
+           /* don't count the newline in the line length */
+           len--;
+
+           /* read in the line properly */
+           fileptr = read_line(buf, fileptr, &line1ins, len);
+
+           /* reset the line length, in preparation for the next line */
+           len = 0;
+
            num_lines++;
            buf[0] = 0;
            i = 0;
 #ifndef NANO_SMALL
        /* If it's a Mac file (no LF just a CR), and file conversion
           isn't disabled, handle it! */
-       } else if (!ISSET(NO_CONVERT) && i > 0 && buf[i-1] == '\r') {
+       } else if (!ISSET(NO_CONVERT) && i > 0 && buf[i - 1] == '\r') {
            fileformat = 2;
-           fileptr = read_line(buf, fileptr, &line1ins);
+
+           /* don't count the newline in the line length */
+           len--;
+
+           /* read in the line properly */
+           fileptr = read_line(buf, fileptr, &line1ins, len);
+
+           /* reset the line length, in preparation for the next line */
+           len = 0;
+
            num_lines++;
+           totsize++;
            buf[0] = input;
            buf[1] = 0;
            i = 1;
@@ -230,8 +257,15 @@
 
     /* Did we not get a newline but still have stuff to do? */
     if (buf[0]) {
-       fileptr = read_line(buf, fileptr, &line1ins);
+
+       /* read in the line properly */
+       fileptr = read_line(buf, fileptr, &line1ins, len);
+
+       /* reset the line length, in preparation for the next line */
+       len = 0;
+
        num_lines++;
+       totsize++;
        buf[0] = 0;
     }
 
@@ -450,13 +484,6 @@
        }
 #endif
 
-       /* Here is a kludge.  If the current file is blank (including
-        * after new_file()), then totlines==1 and totsize==0.  Thus
-        * after open_pipe() or open_file() below, the totsize is short
-        * by one. */
-       if (totlines==1 && totsize==0)
-           totsize++;
-
 #ifndef NANO_SMALL
        if (i == NANO_EXTCMD_KEY) {
            i = open_pipe(answer);
@@ -1212,7 +1239,7 @@
  * append == 2 means we are prepending instead of overwriting.
  *
  * nonamechange means don't change the current filename, it is ignored
- * if tmp == 1.
+ * if tmp == 1 or if we're appending/prepending.
  */
 int write_file(char *name, int tmp, int append, int nonamechange)
 {
@@ -1312,7 +1339,7 @@
 
     dump_buffer(fileage);
 
-    f = fdopen(fd, append==1 ? "ab" : "wb");
+    f = fdopen(fd, append == 1 ? "ab" : "wb");
     if (!f) {
         statusbar(_("Could not open file for writing: %s"),
                   strerror(errno));
@@ -1326,7 +1353,15 @@
            break;
 
        data_len = strlen(fileptr->data);
+
+       /* newlines to nulls, just before we write to disk */
+       sunder(fileptr->data);
+
        size = fwrite(fileptr->data, 1, data_len, f);
+
+       /* nulls to newlines; data_len is the string's real length here */
+       unsunder(fileptr->data, data_len);
+
        if (size < data_len) {
            statusbar(_("Could not open file for writing: %s"),
                      strerror(errno));
@@ -1354,7 +1389,15 @@
        int data_len;
 
        data_len = strlen(fileptr->data);
+
+       /* newlines to nulls, just before we write to disk */
+       sunder(fileptr->data);
+
        size = fwrite(fileptr->data, 1, data_len, f);
+
+       /* nulls to newlines; data_len is the string's real length here */
+       unsunder(fileptr->data, data_len);
+
        if (size < data_len) {
            statusbar(_("Could not open file for writing: %s"),
                      strerror(errno));
@@ -1486,7 +1529,7 @@
        statusbar(_("Could not set permissions %o on %s: %s"),
                  mask, realname, strerror(errno));
 
-    if (!tmp) {
+    if (!tmp && !append) {
        if (!nonamechange)
            filename = mallocstrcpy(filename, realname);
 
@@ -1589,9 +1632,9 @@
            TOGGLE(MAC_FILE);
            return(do_writeout(answer, exiting, append));
        } else if (i == NANO_PREPEND_KEY)
-           return(do_writeout(answer, exiting, append==2 ? 0 : 2));
+           return(do_writeout(answer, exiting, append == 2 ? 0 : 2));
        else if (i == NANO_APPEND_KEY)
-           return(do_writeout(answer, exiting, append==1 ? 0 : 1));
+           return(do_writeout(answer, exiting, append == 1 ? 0 : 1));
 
 #ifdef DEBUG
            fprintf(stderr, _("filename is %s"), answer);
diff -urN nano-1.1.9-cvs/global.c nano-1.1.9-cvs-fixed/global.c
--- nano-1.1.9-cvs/global.c     Sun May 12 15:52:15 2002
+++ nano-1.1.9-cvs-fixed/global.c       Fri May 17 13:54:29 2002
@@ -38,7 +38,7 @@
  */
 
 int flags = 0;                 /* Our new flag containing many options */
-WINDOW *edit;                  /* The file portion of the editor  */
+WINDOW *edit;                  /* The file portion of the editor */
 WINDOW *topwin;                        /* Top line of screen */
 WINDOW *bottomwin;             /* Bottom buffer */
 char *filename = NULL;         /* Name of the file */
diff -urN nano-1.1.9-cvs/move.c nano-1.1.9-cvs-fixed/move.c
--- nano-1.1.9-cvs/move.c       Sun May 12 15:52:15 2002
+++ nano-1.1.9-cvs-fixed/move.c Fri May 17 13:54:29 2002
@@ -112,7 +112,6 @@
 {
     wrap_reset();
     if (current->next != NULL) {
-       update_line(current->prev, 0);
        if (placewewant > 0)
            current_x = actual_x(current->next, placewewant);
     } else {
@@ -155,12 +154,11 @@
        current_y = 0;
 
     update_cursor();
-
 }
 
 int do_page_up(void)
 {
-   int i;
+    int i;
 
     wrap_reset();
     current_x = 0;
@@ -181,7 +179,6 @@
     check_statblank();
     return 1;
 }
-
 
 int do_up(void)
 {
diff -urN nano-1.1.9-cvs/nano.c nano-1.1.9-cvs-fixed/nano.c
--- nano-1.1.9-cvs/nano.c       Sun May 12 15:52:15 2002
+++ nano-1.1.9-cvs-fixed/nano.c Fri May 17 13:54:29 2002
@@ -1367,6 +1367,9 @@
     char *prevanswer = NULL, *save_search = NULL, *save_replace = NULL;
     filestruct *begin;
     int i = 0, j = 0, beginx, beginx_top, reverse_search_set;
+#ifndef NANO_SMALL
+    int mark_set;
+#endif
 
     /* save where we are */
     begin = current;
@@ -1376,6 +1379,12 @@
     reverse_search_set = ISSET(REVERSE_SEARCH);
     UNSET(REVERSE_SEARCH);
 
+#ifndef NANO_SMALL
+    /* Make sure the marking highlight is off during Spell Check */
+    mark_set = ISSET(MARK_ISSET);
+    UNSET(MARK_ISSET);
+#endif
+
     /* save the current search/replace strings */
     search_init_globals();
     save_search = mallocstrcpy(save_search, last_search);
@@ -1438,6 +1447,12 @@
     if (reverse_search_set)
        SET(REVERSE_SEARCH);
 
+#ifndef NANO_SMALL
+    /* restore marking highlight */
+    if (mark_set)
+       SET(MARK_ISSET);
+#endif
+
     edit_update(current, CENTER);
 
     if (i == -1)
@@ -1451,8 +1466,7 @@
 {
     char *read_buff, *read_buff_ptr, *read_buff_word;
     size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
-    int in_fd[2], tempfile_fd;
-    int spell_status;
+    int in_fd[2], tempfile_fd, spell_status;
     pid_t pid_spell;
 
     /* Create a pipe to spell program */
@@ -1583,12 +1597,25 @@
 {
     int alt_spell_status, lineno_cur = current->lineno;
     int x_cur = current_x, y_cur = current_y, pww_cur = placewewant;
+#ifndef NANO_SMALL
+    int mark_set = 0, mbb_lineno_cur, mbx_cur;
+#endif
 
     pid_t pid_spell;
     char *ptr;
     static int arglen = 3;
     static char **spellargs = (char **) NULL;
 
+#ifndef NANO_SMALL
+    mark_set = ISSET(MARK_ISSET);
+    if (mark_set) {
+       /* Save the marking position */
+       mbb_lineno_cur = mark_beginbuf->lineno;
+       mbx_cur = mark_beginx;
+       UNSET(MARK_ISSET);
+    }
+#endif
+
     endwin();
 
     /* Set up an argument list to pass the execvp function */
@@ -1635,6 +1662,15 @@
     global_init(1);
     open_file(file_name, 0, 1);
 
+#ifndef NANO_SMALL
+    if (mark_set) {
+       /* Restore the marking position */
+       do_gotopos(mbb_lineno_cur, mbx_cur, y_cur, 0);
+       mark_beginbuf = current;
+       SET(MARK_ISSET);
+    }
+#endif
+
     /* go back to the old position, mark the file as modified, and make
        sure that the titlebar is refreshed */
     do_gotopos(lineno_cur, x_cur, y_cur, pww_cur);
@@ -3138,7 +3174,7 @@
 
        kbinput = wgetch(edit);
 #ifdef DEBUG
-       fprintf(stderr, "AHA!  %c (%d)\n", kbinput, kbinput);
+       fprintf(stderr, _("AHA!  %c (%d)\n"), kbinput, kbinput);
 #endif
 
        if (kbinput == 27) {    /* Grab Alt-key stuff first */
@@ -3421,7 +3457,7 @@
                break;
            default:
 #ifdef DEBUG
-               fprintf(stderr, "I got %c (%d)!\n", kbinput, kbinput);
+               fprintf(stderr, _("I got %c (%d)!\n"), kbinput, kbinput);
 #endif
                /* We no longer stop unhandled sequences so that people with
                   odd character sets can type... */
diff -urN nano-1.1.9-cvs/nanorc.sample nano-1.1.9-cvs-fixed/nanorc.sample
--- nano-1.1.9-cvs/nanorc.sample        Sun May 12 20:09:30 2002
+++ nano-1.1.9-cvs-fixed/nanorc.sample  Fri May 17 13:54:29 2002
@@ -103,4 +103,3 @@
 #
 # syntax "mutt"
 # color green "^>.*"
-
diff -urN nano-1.1.9-cvs/proto.h nano-1.1.9-cvs-fixed/proto.h
--- nano-1.1.9-cvs/proto.h      Sun May 12 15:52:15 2002
+++ nano-1.1.9-cvs-fixed/proto.h        Fri May 17 13:54:29 2002
@@ -175,6 +175,8 @@
 char *real_dir_from_tilde(char *buf);
 
 void signal_init(void);
+void unsunder(char *str, int true_len);
+void sunder(char *str);
 void lowercase(char *src);
 void blank_bottombars(void);
 void check_wrap(filestruct * inptr);
diff -urN nano-1.1.9-cvs/rcfile.c nano-1.1.9-cvs-fixed/rcfile.c
--- nano-1.1.9-cvs/rcfile.c     Sun May 12 15:52:15 2002
+++ nano-1.1.9-cvs-fixed/rcfile.c       Fri May 17 13:54:29 2002
@@ -221,7 +221,7 @@
            tmpsyntax = syntaxes;
 #ifdef DEBUG
            fprintf(stderr,
-                   "Starting a new syntax type\n");
+                   _("Starting a new syntax type\n"));
            fprintf(stderr, "string val=%s\n", nameptr);
 #endif
 
@@ -229,7 +229,7 @@
            for (tmpsyntax = syntaxes;
                 tmpsyntax->next != NULL; tmpsyntax = tmpsyntax->next);
 #ifdef DEBUG
-           fprintf(stderr, "Adding new syntax after 1st\n");
+           fprintf(stderr, _("Adding new syntax after 1st\n"));
 #endif
 
            tmpsyntax->next = nmalloc(sizeof(syntaxtype));
@@ -345,17 +345,17 @@
            tmpcolor = tmpsyntax->color;
 #ifdef DEBUG
            fprintf(stderr,
-                   "Starting a new colorstring for fg %d bg %d\n",
+                   _("Starting a new colorstring for fg %d bg %d\n"),
                    fg, bg);
-           fprintf(stderr, "string val=%s\n", tmp);
+           fprintf(stderr, _("string val=%s\n"), tmp);
 #endif
 
        } else {
            for (tmpcolor = tmpsyntax->color;
                 tmpcolor->next != NULL; tmpcolor = tmpcolor->next);
 #ifdef DEBUG
-           fprintf(stderr, "Adding new entry for fg %d bg %d\n", fg, bg);
-           fprintf(stderr, "string val=%s\n", tmp);
+           fprintf(stderr, _("Adding new entry for fg %d bg %d\n"), fg, bg);
+           fprintf(stderr, _("string val=%s\n"), tmp);
 #endif
 
            tmpcolor->next = nmalloc(sizeof(colortype));
@@ -387,7 +387,7 @@
            beginning = ptr;
            ptr = parse_next_regex(ptr);
 #ifdef DEBUG
-           fprintf(stderr, "For end part, beginning = \"%s\"\n",
+           fprintf(stderr, _("For end part, beginning = \"%s\"\n"),
                    beginning);
 #endif
            tmp = NULL;
diff -urN nano-1.1.9-cvs/search.c nano-1.1.9-cvs-fixed/search.c
--- nano-1.1.9-cvs/search.c     Sun May 12 15:52:15 2002
+++ nano-1.1.9-cvs-fixed/search.c       Fri May 17 13:54:29 2002
@@ -863,11 +863,9 @@
     current_y = pos_y;
     do_gotoline(line, 1);
 
-    /* recalculate the x-coordinate and place we want, just in case their
-       values are insane; if they aren't, they won't be changed by this */
-    current_x = pos_x;
-    pos_placewewant = xplustabs();
-    pos_x = actual_x(current, pos_placewewant);
+    /* make sure that the x-coordinate is sane here */
+    if (pos_x > strlen(current->data))
+       pos_x = strlen(current->data);
 
     /* set the rest of the coordinates up */
     current_x = pos_x;
diff -urN nano-1.1.9-cvs/utils.c nano-1.1.9-cvs-fixed/utils.c
--- nano-1.1.9-cvs/utils.c      Sun May 12 15:52:15 2002
+++ nano-1.1.9-cvs-fixed/utils.c        Fri May 17 13:54:29 2002
@@ -52,6 +52,32 @@
     return i;
 }
 
+/* For non-null-terminated lines.  A line, by definition, shouldn't
+   normally have newlines in it, so encode its nulls as newlines. */
+void unsunder(char *str, int true_len)
+{
+    int i;
+    if (strlen(str) < true_len) {
+       for (i = 0; i < true_len; i++) {
+           if (str[i] == '\0')
+               str[i] = '\n';
+       }
+    }
+}
+
+/* For non-null-terminated lines.  A line, by definition, shouldn't
+   normally have newlines in it, so decode its newlines into nulls. */
+void sunder(char *str)
+{
+    int i, true_len = strlen(str);
+    if (strchr(str, '\n')) {
+       for (i = 0; i < true_len; i++) {
+           if (str[i] == '\n')
+               str[i] = '\0';
+       }
+    }
+}
+
 /* Lower case a string - must be null terminated */
 void lowercase(char *src)
 {
diff -urN nano-1.1.9-cvs/winio.c nano-1.1.9-cvs-fixed/winio.c
--- nano-1.1.9-cvs/winio.c      Sun May 12 16:43:49 2002
+++ nano-1.1.9-cvs-fixed/winio.c        Fri May 17 13:56:20 2002
@@ -117,6 +117,9 @@
        else if (fileptr->data[i] < 32 || fileptr->data[i] == 127) {
            i++;
            tot += 2;
+           /* if we don't do this, the result will be high */
+           if (tot > xplus || fileptr->data[i] == 0)
+               i -= (tot - xplus);
        }
 
 #ifdef DEBUG
@@ -504,6 +507,13 @@
        nanoget_repaint(buf, inputbuf, x);
        wrefresh(bottomwin);
     }
+#ifndef DISABLE_TABCOMP
+    /* if we've done tab completion, there might be a list of filename
+       matches on the edit window at this point; make sure they're
+       cleared off */
+    if (list)
+       edit_refresh();
+#endif
 
     answer = mallocstrcpy(answer, inputbuf);
     free(inputbuf);
@@ -817,7 +827,7 @@
                        break;
                    }
 #ifdef DEBUG
-                   fprintf(stderr, "Match! (%d chars) \"%s\"\n",
+                   fprintf(stderr, _("Match! (%d chars) \"%s\"\n"),
                            colormatches[0].rm_eo - colormatches[0].rm_so,
                            &fileptr->data[k + colormatches[0].rm_so]);
 #endif
@@ -830,7 +840,7 @@
                            paintlen =
                                colormatches[0].rm_eo - colormatches[0].rm_so;
 #ifdef DEBUG
-                           fprintf(stderr, "paintlen (%d) = eo (%d) - so 
(%d)\n", 
+                           fprintf(stderr, _("paintlen (%d) = eo (%d) - so 
(%d)\n"), 
                                paintlen, colormatches[0].rm_eo, 
colormatches[0].rm_so);
 #endif
 
@@ -838,7 +848,7 @@
                        else {
                            paintlen = COLS - k - colormatches[0].rm_so - 1;
 #ifdef DEBUG
-                           fprintf(stderr, "paintlen (%d) = COLS (%d) - k 
(%d), - rm.so (%d) - 1\n", 
+                           fprintf(stderr, _("paintlen (%d) = COLS (%d) - k 
(%d), - rm.so (%d) - 1\n"), 
                                        paintlen, COLS, k, 
colormatches[0].rm_so);
 #endif
                        }
@@ -941,7 +951,7 @@
                                        &fileptr->data[start + smatch],
                                        ematch - smatch);
 #ifdef DEBUG
-                       fprintf(stderr, "start = %d, smatch = %d, ematch = 
%d\n", start,
+                       fprintf(stderr, _("start = %d, smatch = %d, ematch = 
%d\n"), start,
                                smatch, ematch);
 #endif
 
@@ -1181,12 +1191,31 @@
            if (i < mark_beginx)
                virt_mark_beginx--;
        } else if (realdata[i] == 127) {
-           /* Treat control characters as ^symbol (ASCII 1 - 31, 127) */
+           /* Treat control characters as ^symbol (ASCII 1 - 31 omitting
+              10, 127) */
            fileptr->data[pos++] = '^';
            fileptr->data[pos++] = '?';
-       } else if (realdata[i] >= 1 && realdata[i] <= 31) {
+           if (i < current_x)
+               virt_cur_x++;
+           if (i < mark_beginx)
+               virt_mark_beginx++;
+       } else if (realdata[i] >= 1 && realdata[i] <= 31 && realdata[i] != 10) {
            fileptr->data[pos++] = '^';
            fileptr->data[pos++] = realdata[i] + 64;
+           if (i < current_x)
+               virt_cur_x++;
+           if (i < mark_beginx)
+               virt_mark_beginx++;
+       } else if (realdata[i] == 10) {
+           /* Treat newlines (ASCII 10's) embedded in a line as encoded
+              nulls (ASCII 0's); the line in question should be run
+              through unsunder() before reaching here */
+           fileptr->data[pos++] = '^';
+           fileptr->data[pos++] = '@';
+           if (i < current_x)
+               virt_cur_x++;
+           if (i < mark_beginx)
+               virt_mark_beginx++;
        } else {
            fileptr->data[pos++] = realdata[i];
        }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]