From 1eae103073f5c7c854b2e72b0697a04c48c27506 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 14 Aug 2002 02:55:26 +0000 Subject: [PATCH] Fix bug in field-sorting commands: if there was no linear whitespace on the line, it failed to correctly detect the end of the field. --- v7/src/edwin/sort.scm | 101 ++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/v7/src/edwin/sort.scm b/v7/src/edwin/sort.scm index 10291d81d..a8b042ce5 100644 --- a/v7/src/edwin/sort.scm +++ b/v7/src/edwin/sort.scm @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: sort.scm,v 1.7 1999/01/02 06:11:34 cph Exp $ +;;; $Id: sort.scm,v 1.8 2002/08/14 02:55:26 cph Exp $ ;;; -;;; Copyright (c) 1992, 1999 Massachusetts Institute of Technology +;;; Copyright (c) 1992, 1999, 2002 Massachusetts Institute of Technology ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -29,22 +29,18 @@ (let* ((start (region-start region)) (end (region-end region)) (delete-end (mark-right-inserting-copy end)) - (unsorted-list - (identify-records region forward-record record-end)) + (unsorted-list (identify-records region forward-record record-end)) (sorted-list - (sort - unsorted-list - (let ((order (if reverse? - not - identity-procedure))) - (lambda (element1 element2) - (order - (let ((start1 (key-start (car element1))) - (start2 (key-start (car element2)))) - (compare start1 - (key-end start1) - start2 - (key-end start2))))))))) + (sort unsorted-list + (let ((order (if reverse? not identity-procedure))) + (lambda (element1 element2) + (order + (let ((start1 (key-start (car element1) (cdr element1))) + (start2 (key-start (car element2) (cdr element2)))) + (compare start1 + (key-end start1 (cdr element1)) + start2 + (key-end start2 (cdr element2)))))))))) (insert-reordered-region start end sorted-list unsorted-list) (kill-string start delete-end) (mark-temporary! delete-end))) @@ -94,9 +90,9 @@ (string2 (extract-string start2 end2))) (let ((value1 (string->number string1)) (value2 (string->number string2))) - (if (or (not value1) (not value2)) - (string