]> git.wh0rd.org Git - nano.git/commitdiff
This should finish the -k functionality. Would someone be kind enough to test this...
authorChris Allegretta <chrisa@asty.org>
Thu, 27 Jul 2000 05:09:22 +0000 (05:09 +0000)
committerChris Allegretta <chrisa@asty.org>
Thu, 27 Jul 2000 05:09:22 +0000 (05:09 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@132 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

cut.c
po/nano.pot

diff --git a/cut.c b/cut.c
index 290309a1105ab09bab33f8e495a3a365c8d6815c..dbe1b461097e70f8220dda5e198bcccc73fd94ab 100644 (file)
--- a/cut.c
+++ b/cut.c
@@ -153,9 +153,6 @@ int do_cut_text(void)
     if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
        if (current_x == strlen(current->data))
        {
-
-           /* FIXME - We really need to put this data into the
-              cutbuffer, not delete it and forget about it. */
            do_delete();
            SET(KEEP_CUTBUFFER);
            marked_cut = 2;
@@ -315,7 +312,6 @@ int do_uncut_text(void)
 
            placewewant = xplustabs();
            update_cursor();
-           renumber(current);
        } else {                /* yuck -- no kidding! */
            tmp = current->next;
            /* New beginning */
@@ -358,13 +354,27 @@ int do_uncut_text(void)
 
            i = editbot->lineno;
 
-           renumber(current);
-
            current = newend;
            if (i <= newend->lineno)
                edit_update(current);
        }
 
+       /* If marked cut == 2, that means that we're doing a cut to end
+          and we don't want anything else on the line, so we have to
+          screw up all the work we just did and separate the line.  There
+          must be a better way to do this, but not at 1AM on a work night. */
+
+       if (marked_cut == 2 && current_x != strlen(current->data)) {
+           tmp = make_new_node(current);
+           tmp->data = nmalloc(strlen(&current->data[current_x]));
+           strcpy(tmp->data, &current->data[current_x]);
+           tmp->next = current->next;
+           current->next = tmp;
+           tmp->prev = current;
+           current->data[current_x] = 0;
+           current->data = nrealloc(current->data, strlen(current->data) + 1);     
+       }
+       renumber(current);
        dump_buffer(fileage);
        dump_buffer(cutbuffer);
        set_modified();
index 5dafffd23648da74746ce68e8f261b5e4e05bd45..cf8547d771ef54740c4eac94de6abf201e1b392c 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-07-27 00:27-0400\n"
+"POT-Creation-Date: 2000-07-27 01:11-0400\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"