From: Chris Hanson Date: Tue, 9 May 1995 10:32:36 +0000 (+0000) Subject: Fix two small bugs in the paragraph-parsing code. X-Git-Tag: 20090517-FFI~6327 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=bc09f39f9a74cf512e7e1035a0906456c79f7726;p=mit-scheme.git Fix two small bugs in the paragraph-parsing code. --- diff --git a/v7/src/edwin/tparse.scm b/v7/src/edwin/tparse.scm index 5d5891a31..1667f128a 100644 --- a/v7/src/edwin/tparse.scm +++ b/v7/src/edwin/tparse.scm @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: tparse.scm,v 1.69 1994/03/03 07:46:52 cph Exp $ +;;; $Id: tparse.scm,v 1.70 1995/05/09 10:32:36 cph Exp $ ;;; -;;; Copyright (c) 1986, 1989-94 Massachusetts Institute of Technology +;;; Copyright (c) 1986, 1989-95 Massachusetts Institute of Technology ;;; ;;; This material was developed by the Scheme project at the ;;; Massachusetts Institute of Technology, Department of @@ -285,18 +285,18 @@ This is desirable in modes where blank lines are the paragraph delimiters." (re-match-forward para-separate ls end false))))) (letrec ((skip-separators (lambda (ls) - (and (mark< start ls) - (let ((ls (prev-ls ls))) - (cond ((separator? ls) (skip-separators ls)) - ((mark= ls start) ls) - (else (skip-body ls))))))) + (cond ((not (separator? ls)) (skip-body ls)) + ((mark<= ls start) #f) + (else (skip-separators (prev-ls ls)))))) (skip-body (if fill-prefix (lambda (ls) - (let ((ls* (prev-ls ls))) - (if (separator? ls*) - ls - (skip-body ls*)))) + (if (mark<= ls start) + start + (let ((ls* (prev-ls ls))) + (if (separator? ls*) + ls + (skip-body ls*))))) (lambda (ls) (let ((ps (re-search-backward para-start @@ -306,10 +306,7 @@ This is desirable in modes where blank lines are the paragraph delimiters." (cond ((not ps) start) ((separator? ps) (line-start ps 1)) (else ps))))))) - (let ((ls (line-start mark 0))) - (if (separator? ls) - (skip-separators ls) - (skip-body ls)))))))) + (skip-separators (line-start mark 0))))))) (define (paragraph-text-end mark) (let ((end (group-end mark)) @@ -344,11 +341,11 @@ This is desirable in modes where blank lines are the paragraph delimiters." (if fill-prefix (lambda (ls) (finish - (let ((ls (next-ls ls))) - (if (or (mark= ls end) - (separator? ls)) - ls - (skip-body ls))))) + (let loop ((ls ls)) + (let ((ls (next-ls ls))) + (if (or (mark= ls end) (separator? ls)) + ls + (loop ls)))))) (lambda (ls) (finish (let ((le (line-end ls 0)))