fix crlf mode initialization
original commit: b71e562284168419abb5500e2eaceb9d0488f363
This commit is contained in:
parent
089022da68
commit
c4deab2e67
|
@ -1818,6 +1818,8 @@
|
||||||
(define/augment (after-load-file success?)
|
(define/augment (after-load-file success?)
|
||||||
(cond
|
(cond
|
||||||
[(preferences:get 'framework:always-use-platform-specific-linefeed-convention)
|
[(preferences:get 'framework:always-use-platform-specific-linefeed-convention)
|
||||||
|
(use-file-text-mode #t)]
|
||||||
|
[else
|
||||||
(define unix-endings?
|
(define unix-endings?
|
||||||
(with-handlers ((exn:fail:filesystem? (λ (x) #t)))
|
(with-handlers ((exn:fail:filesystem? (λ (x) #t)))
|
||||||
(call-with-input-file (get-filename)
|
(call-with-input-file (get-filename)
|
||||||
|
@ -1825,12 +1827,16 @@
|
||||||
(regexp-match? unix-line-endings-regexp port)))))
|
(regexp-match? unix-line-endings-regexp port)))))
|
||||||
(use-file-text-mode
|
(use-file-text-mode
|
||||||
(and (eq? (system-type) 'windows)
|
(and (eq? (system-type) 'windows)
|
||||||
unix-endings?))]
|
(not unix-endings?)))])
|
||||||
[else (use-file-text-mode #t)])
|
|
||||||
(inner (void) after-load-file success?))
|
(inner (void) after-load-file success?))
|
||||||
|
|
||||||
(super-new)))
|
(super-new)
|
||||||
|
|
||||||
|
;; for empty files we want to use LF mode so
|
||||||
|
;; set it this way until a file is loaded in the editor
|
||||||
|
(when (eq? (system-type) 'windows)
|
||||||
|
(unless (preferences:get 'framework:always-use-platform-specific-linefeed-convention)
|
||||||
|
(use-file-text-mode #f)))))
|
||||||
|
|
||||||
(define file<%>
|
(define file<%>
|
||||||
(interface (editor:file<%> basic<%>)
|
(interface (editor:file<%> basic<%>)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user