commit 0083bd29d2b358a46f96c0e5525f66c81d4007fb
parent ce51bb250977bc8e3420ab84acda7760f7f60ca5
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 9 Nov 2005 18:26:44 +0000
tweak begpar() to rely on fileage instead of NULL for its check to
detect the top of the file, and make it return NULL if foo is NULL, just
as inpar() does
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3126 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -47,7 +47,8 @@ CVS code -
file. Changes to cut_line(), cut_to_eol(), do_page_up(),
do_page_down(), do_para_end(), do_next_word(), do_prev_word(),
do_up(), do_down(), do_scroll_down(), do_right(), do_mouse(),
- do_gotolinecolumn(), do_delete(), and find_paragraph(). (DLR)
+ do_gotolinecolumn(), do_delete(), begpar(), and
+ find_paragraph(). (DLR)
- Add new -L/--nonewlines command line option, and new
"nonewlines" rcfile option, to control whether nano adds
magiclines to the ends of files. Changes to read_file(),
@@ -105,6 +106,8 @@ CVS code -
do_rcfile()
- Remove unneeded assert. (DLR)
- text.c:
+ begpar()
+ - Return FALSE if foo is NULL, as inpar() does. (DLR)
do_alt_speller()
- Move the code that replaces the text of the current file with
the text of the spell-checked file into its own function,
diff --git a/src/text.c b/src/text.c
@@ -899,12 +899,13 @@ bool indents_match(const char *a_line, size_t a_indent, const char
* autoindent is turned on. */
bool begpar(const filestruct *const foo)
{
- size_t quote_len;
- size_t indent_len;
- size_t temp_id_len;
+ size_t quote_len, indent_len, temp_id_len;
+
+ if (foo == NULL)
+ return FALSE;
/* Case 1). */
- if (foo->prev == NULL)
+ if (foo == openfile->fileage)
return TRUE;
quote_len = quote_length(foo->data);