From 2fa7b2d35dc675a306fe975325e613f1dd934bf5 Mon Sep 17 00:00:00 2001 From: chaos-zhu Date: Sat, 23 May 2026 22:06:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(mobile):=20=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E6=89=93=E5=BC=80=E5=8D=B3=E6=8F=90=E7=A4=BA=E6=9C=AA=E4=BF=9D?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CodeLineEditingController 解析时会把 CRLF 规范化为 LF,导致 code.text 与原始 _originalText 不一致,isDirty 误报为 true。 改为以解析后的 code.text 作为 baseline 进行比较。 --- mobile/lib/features/shell/editor/text_editor_controller.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile/lib/features/shell/editor/text_editor_controller.dart b/mobile/lib/features/shell/editor/text_editor_controller.dart index b189fa4..eabf4d8 100644 --- a/mobile/lib/features/shell/editor/text_editor_controller.dart +++ b/mobile/lib/features/shell/editor/text_editor_controller.dart @@ -16,8 +16,9 @@ class TextEditorController extends ChangeNotifier { required this.language, required this.totalBytes, }) : _writer = writer, - _originalText = originalText, + _originalText = '', code = CodeLineEditingController.fromText(originalText) { + _originalText = code.text; code.addListener(_onCodeChanged); }