Back out the changes I made to nano.c to catch the spelling scroll bug earlier

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1352 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2003-01-15 11:18:58 +00:00
parent 0e7a3f5e2d
commit 908f770f7d
1 changed files with 21 additions and 21 deletions

42
nano.c
View File

@ -2,7 +2,7 @@
/************************************************************************** /**************************************************************************
* nano.c * * nano.c *
* * * *
* Copyright (C) 1999-2002 Chris * * Copyright (C) 1999-2002 Chris Allegretta *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2, or (at your option) * * the Free Software Foundation; either version 2, or (at your option) *
@ -260,7 +260,7 @@ void mouse_init(void)
* help_text should be NULL initially. */ * help_text should be NULL initially. */
void help_init(void) void help_init(void)
{ {
size_t allocated = 1; /* space needed for help_text */ size_t allocsize = 1; /* space needed for help_text */
char *ptr = NULL; char *ptr = NULL;
#ifndef NANO_SMALL #ifndef NANO_SMALL
const toggle *t; const toggle *t;
@ -366,11 +366,11 @@ void help_init(void)
"following keystrokes are available in the main editor window. " "following keystrokes are available in the main editor window. "
"Alternative keys are shown in parentheses:\n\n"); "Alternative keys are shown in parentheses:\n\n");
allocated += strlen(ptr); allocsize += strlen(ptr);
/* The space needed for the shortcut lists, at most COLS characters, /* The space needed for the shortcut lists, at most COLS characters,
* plus '\n'. */ * plus '\n'. */
allocated += (COLS + 1) * length_of_list(currshortcut); allocsize += (COLS + 1) * length_of_list(currshortcut);
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* If we're on the main list, we also count the toggle help text. /* If we're on the main list, we also count the toggle help text.
@ -378,7 +378,7 @@ void help_init(void)
* COLS - 24 characters, plus '\n'.*/ * COLS - 24 characters, plus '\n'.*/
if (currshortcut == main_list) if (currshortcut == main_list)
for (t = toggles; t != NULL; t = t->next) for (t = toggles; t != NULL; t = t->next)
allocated += COLS - 17; allocsize += COLS - 17;
#endif /* !NANO_SMALL */ #endif /* !NANO_SMALL */
/* help_text has been freed and set to NULL unless the user resized /* help_text has been freed and set to NULL unless the user resized
@ -386,7 +386,7 @@ void help_init(void)
free(help_text); free(help_text);
/* Allocate space for the help text */ /* Allocate space for the help text */
help_text = charalloc(allocated); help_text = charalloc(allocsize);
/* Now add the text we want */ /* Now add the text we want */
strcpy(help_text, ptr); strcpy(help_text, ptr);
@ -450,7 +450,7 @@ void help_init(void)
/* If all went well, we didn't overwrite the allocated space for /* If all went well, we didn't overwrite the allocated space for
help_text. */ help_text. */
assert(strlen(help_text) < allocated); assert(strlen(help_text) < allocsize);
} }
#endif #endif
@ -2187,30 +2187,30 @@ filestruct *backup_lines(filestruct *first_line, size_t par_len,
/* We put the original lines, not copies, into the cut buffer, just /* We put the original lines, not copies, into the cut buffer, just
* out of a misguided sense of consistency, so if you un-cut, you * out of a misguided sense of consistency, so if you un-cut, you
* get the actual same paragraph back, not a copy. */ * get the actual same paragraph back, not a copy. */
filestruct *letter = first_line; filestruct *alice = first_line;
set_modified(); set_modified();
cutbuffer = NULL; cutbuffer = NULL;
for(; par_len > 0; par_len--) { for(; par_len > 0; par_len--) {
filestruct *bob = copy_node(letter); filestruct *bob = copy_node(alice);
if (letter == first_line) if (alice == first_line)
first_line = bob; first_line = bob;
if (letter == current) if (alice == current)
current = bob; current = bob;
if (letter == edittop) if (alice == edittop)
edittop = bob; edittop = bob;
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (letter == mark_beginbuf) if (alice == mark_beginbuf)
mark_beginbuf = bob; mark_beginbuf = bob;
#endif #endif
justify_format(1, bob, justify_format(1, bob,
quote_len + indent_length(bob->data + quote_len)); quote_len + indent_length(bob->data + quote_len));
assert(letter != NULL && bob != NULL); assert(alice != NULL && bob != NULL);
add_to_cutbuffer(letter); add_to_cutbuffer(alice);
splice_node(bob->prev, bob, bob->next); splice_node(bob->prev, bob, bob->next);
letter = bob->next; alice = bob->next;
} }
return first_line; return first_line;
} }
@ -2966,7 +2966,7 @@ void do_toggle(const toggle *which)
/* This function returns the correct keystroke, given the A,B,C or D /* This function returns the correct keystroke, given the A,B,C or D
input key. This is a common sequence of many terms which send input key. This is a common sequence of many terms which send
Esc-O-[A-D] or Esc-[-[A-D]. */ Esc-O-[A-D] or Esc-[-[A-D]. */
int alphabet(int input) int abcd(int input)
{ {
switch (input) { switch (input) {
case 'A': case 'A':
@ -3087,11 +3087,11 @@ int main(int argc, char *argv[])
#endif #endif
#ifdef HAVE_GETOPT_LONG #ifdef HAVE_GETOPT_LONG
while ((optchr = getopt_long(argc, argv, "h?BDFIKMNQ:RST:VY::pr:s:tvwxz", while ((optchr = getopt_long(argc, argv, "h?BDFIKMNQ:RST:VY:abcefgijklmo:pr:s:tvwxz",
long_options, &option_index)) != -1) { long_options, &option_index)) != -1) {
#else #else
while ((optchr = while ((optchr =
getopt(argc, argv, "h?BDFIKMNQ:RST:VY::pr:s:tvwxz")) != -1) { getopt(argc, argv, "h?BDFIKMNQ:RST:VY:abcefgijklmo:pr:s:tvwxz")) != -1) {
#endif #endif
switch (optchr) { switch (optchr) {
@ -3460,7 +3460,7 @@ int main(int argc, char *argv[])
kbinput = wgetch(edit); kbinput = wgetch(edit);
if ((kbinput <= 'D' && kbinput >= 'A') || if ((kbinput <= 'D' && kbinput >= 'A') ||
(kbinput <= 'd' && kbinput >= 'a')) (kbinput <= 'd' && kbinput >= 'a'))
kbinput = alphabet(kbinput); kbinput = abcd(kbinput);
else if (kbinput <= 'z' && kbinput >= 'j') else if (kbinput <= 'z' && kbinput >= 'j')
print_numlock_warning(); print_numlock_warning();
else if (kbinput <= 'S' && kbinput >= 'P') else if (kbinput <= 'S' && kbinput >= 'P')
@ -3582,7 +3582,7 @@ int main(int argc, char *argv[])
case 'b': case 'b':
case 'c': case 'c':
case 'd': case 'd':
kbinput = alphabet(kbinput); kbinput = abcd(kbinput);
break; break;
case 'H': case 'H':
kbinput = KEY_HOME; kbinput = KEY_HOME;