From: Chris Allegretta Date: Fri, 28 Jul 2000 00:58:35 +0000 (+0000) Subject: New cvs code, data abstraction is good X-Git-Tag: v0.9.15~25 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7975ed86a788995a6a5e12aa9db0e976fffea5d2;p=nano.git New cvs code, data abstraction is good git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@138 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/BUGS b/BUGS index 79727178..1930e6d0 100644 --- a/BUGS +++ b/BUGS @@ -40,6 +40,8 @@ until a pageup/down occurs (22)[FIXED] - Using nano -t, user can not exit until a filename is given via ^O. (30) [FIXED] +- Doing a cut with -k can screw up the filestruct, fault is in cutting + code. (36) [FIXED] ** Open BUGS ** diff --git a/ChangeLog b/ChangeLog index 35d6cf2a..36da775e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +CVS code +- nano.c: + splice_node(): + - New function, abstracts linking in nodes. Fixes bug #36. + nano-0.9.14 - 07/27/2000 - nano.h: - Set CUT_TO_END to a different bit than TEMP_OPT. Fixes bug #32. diff --git a/configure b/configure index 1c592bd1..7bee9070 100755 --- a/configure +++ b/configure @@ -710,7 +710,7 @@ fi PACKAGE=nano -VERSION=0.9.14 +VERSION=0.9.14-cvs if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } diff --git a/configure.in b/configure.in index edf77cf6..4373bb06 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(nano.c) -AM_INIT_AUTOMAKE(nano, 0.9.14) +AM_INIT_AUTOMAKE(nano, 0.9.14-cvs) AM_CONFIG_HEADER(config.h:config.h.in) ALL_LINGUAS="es de fr it id fi" diff --git a/cut.c b/cut.c index 8950ccd9..d3fcf18a 100644 --- a/cut.c +++ b/cut.c @@ -368,9 +368,7 @@ int do_uncut_text(void) tmp = make_new_node(current); tmp->data = nmalloc(strlen(¤t->data[current_x]) + 1); strcpy(tmp->data, ¤t->data[current_x]); - tmp->next = current->next; - current->next = tmp; - tmp->prev = current; + splice_node(current, tmp, current->next); current->data[current_x] = 0; current->data = nrealloc(current->data, strlen(current->data) + 1); current = current->next; diff --git a/nano.c b/nano.c index 185e6edc..3781632d 100644 --- a/nano.c +++ b/nano.c @@ -417,6 +417,16 @@ filestruct *make_new_node(filestruct * prevnode) return newnode; } +/* Splice a node into an existing filestruct */ +void splice_node(filestruct *begin, filestruct *new, filestruct *end) +{ + new->next = end; + new->prev = begin; + begin->next = new; + if (end != NULL) + end->prev = new; +} + int do_mark() { #ifdef NANO_SMALL @@ -510,15 +520,11 @@ int do_enter(filestruct * inptr) } *tmp = 0; - new->next = inptr->next; - new->prev = inptr; - inptr->next = new; - if (new->next != NULL) - new->next->prev = new; - else { + if (inptr->next != NULL) { filebot = new; editbot = new; } + splice_node(inptr, new, inptr->next); totsize++; renumber(current); diff --git a/po/nano.pot b/po/nano.pot index 78bb3314..1d4bf51b 100644 --- a/po/nano.pot +++ b/po/nano.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-07-27 20:16-0400\n" +"POT-Creation-Date: 2000-07-27 21:00-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -55,7 +55,7 @@ msgstr "" msgid "File to insert [from ./] " msgstr "" -#: files.c:272 files.c:296 files.c:486 nano.c:1149 +#: files.c:272 files.c:296 files.c:486 nano.c:1155 msgid "Cancelled" msgstr "" @@ -563,98 +563,98 @@ msgstr "" msgid " Email: nano@asty.org\tWeb: http://www.asty.org/nano\n" msgstr "" -#: nano.c:426 +#: nano.c:436 msgid "Mark Set" msgstr "" -#: nano.c:431 +#: nano.c:441 msgid "Mark UNset" msgstr "" -#: nano.c:875 +#: nano.c:881 #, c-format msgid "check_wrap called with inptr->data=\"%s\"\n" msgstr "" -#: nano.c:935 +#: nano.c:941 #, c-format msgid "current->data now = \"%s\"\n" msgstr "" -#: nano.c:988 +#: nano.c:994 #, c-format msgid "After, data = \"%s\"\n" msgstr "" -#: nano.c:1058 +#: nano.c:1064 msgid "Error deleting tempfile, ack!" msgstr "" -#: nano.c:1076 +#: nano.c:1082 #, c-format msgid "Could not create a temporary filename: %s" msgstr "" -#: nano.c:1099 +#: nano.c:1105 #, c-format msgid "Could not invoke spell program \"%s\"" msgstr "" #. Why 32512? I dont know! -#: nano.c:1105 +#: nano.c:1111 msgid "Could not invoke \"ispell\"" msgstr "" -#: nano.c:1118 +#: nano.c:1124 msgid "Finished checking spelling" msgstr "" -#: nano.c:1136 +#: nano.c:1142 msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? " msgstr "" -#: nano.c:1259 +#: nano.c:1265 msgid "Cannot resize top win" msgstr "" -#: nano.c:1261 +#: nano.c:1267 msgid "Cannot move top win" msgstr "" -#: nano.c:1263 +#: nano.c:1269 msgid "Cannot resize edit win" msgstr "" -#: nano.c:1265 +#: nano.c:1271 msgid "Cannot move edit win" msgstr "" -#: nano.c:1267 +#: nano.c:1273 msgid "Cannot resize bottom win" msgstr "" -#: nano.c:1269 +#: nano.c:1275 msgid "Cannot move bottom win" msgstr "" -#: nano.c:1742 +#: nano.c:1748 msgid "Main: set up windows\n" msgstr "" -#: nano.c:1764 +#: nano.c:1770 msgid "Main: bottom win\n" msgstr "" -#: nano.c:1770 +#: nano.c:1776 msgid "Main: open file\n" msgstr "" -#: nano.c:1843 +#: nano.c:1849 #, c-format msgid "I got Alt-[-%c! (%d)\n" msgstr "" -#: nano.c:1859 +#: nano.c:1865 #, c-format msgid "I got Alt-%c! (%d)\n" msgstr "" diff --git a/proto.h b/proto.h index 1e0d9df7..465af068 100644 --- a/proto.h +++ b/proto.h @@ -107,6 +107,7 @@ void *nrealloc(void *ptr, size_t howmuch); void die(char *msg, ...); void new_file(void); void new_magicline(void); +void splice_node(filestruct *begin, filestruct *new, filestruct *end); int do_writeout_void(void), do_exit(void), do_gotoline_void(void); int do_insertfile(void), do_search(void), page_up(void), page_down(void);