fix CDLF conversion when loading a text file into an editor
svn: r14512 original commit: 6082e6a9c385409b11d4240cc311fdcf33ec4727
This commit is contained in:
parent
cece9d5dc9
commit
cbf7ba42d4
|
@ -2510,11 +2510,18 @@
|
||||||
(send s-style-list new-named-style "Standard" (send s-style-list basic-style))
|
(send s-style-list new-named-style "Standard" (send s-style-list basic-style))
|
||||||
(send mf ok?))))))]
|
(send mf ok?))))))]
|
||||||
[(or (eq? format 'text) (eq? format 'text-force-cr))
|
[(or (eq? format 'text) (eq? format 'text-force-cr))
|
||||||
(let loop ()
|
(let loop ([saved-cr? #f])
|
||||||
(let ([l (read-string 256 f)])
|
(let ([l (read-string 256 f)])
|
||||||
(unless (eof-object? l)
|
(unless (eof-object? l)
|
||||||
(insert l)
|
(let ([l2 (if (equal? l "")
|
||||||
(loop))))
|
l
|
||||||
|
(if (equal? #\return (string-ref l (sub1 (string-length l))))
|
||||||
|
(substring l 0 (sub1 (string-length l)))
|
||||||
|
l))])
|
||||||
|
(insert (regexp-replace* #rx"\r\n"
|
||||||
|
(if saved-cr? (string-append "\r" l2) l2)
|
||||||
|
"\n"))
|
||||||
|
(loop (not (eq? l l2)))))))
|
||||||
#f])])
|
#f])])
|
||||||
|
|
||||||
(when fileerr?
|
(when fileerr?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user