From 65683cc3e6da99990d8e4bf5e3d18f6403c3e41e Mon Sep 17 00:00:00 2001 From: fufesou <13586388+fufesou@users.noreply.github.com> Date: Sun, 13 Oct 2024 01:07:47 +0800 Subject: [PATCH] refact: remove redundant escape (#9634) * refact: remove redundant escape Signed-off-by: fufesou * flutter, early assert Signed-off-by: fufesou --------- Signed-off-by: fufesou --- flutter/lib/common.dart | 4 ++++ flutter/lib/main.dart | 1 + flutter/lib/mobile/pages/remote_page.dart | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 881cf3b8b..2bbb224cb 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -3616,3 +3616,7 @@ List? get subWindowManagerEnableResizeEdges => isWindows SubWindowResizeEdge.topRight, ] : null; + +void earlyAssert() { + assert('\1' == '1'); +} diff --git a/flutter/lib/main.dart b/flutter/lib/main.dart index 9342c9e50..62574dfe6 100644 --- a/flutter/lib/main.dart +++ b/flutter/lib/main.dart @@ -36,6 +36,7 @@ WindowType? kWindowType; late List kBootArgs; Future main(List args) async { + earlyAssert(); WidgetsFlutterBinding.ensureInitialized(); debugPrint("launch args: $args"); diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index 74b56cd45..19f7cc575 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -155,9 +155,9 @@ class _RemotePageState extends State { var oldValue = _value; _value = newValue; var i = newValue.length - 1; - for (; i >= 0 && newValue[i] != '\1'; --i) {} + for (; i >= 0 && newValue[i] != '1'; --i) {} var j = oldValue.length - 1; - for (; j >= 0 && oldValue[j] != '\1'; --j) {} + for (; j >= 0 && oldValue[j] != '1'; --j) {} if (i < j) j = i; var subNewValue = newValue.substring(j + 1); var subOldValue = oldValue.substring(j + 1); @@ -206,8 +206,8 @@ class _RemotePageState extends State { _value = newValue; if (oldValue.isNotEmpty && newValue.isNotEmpty && - oldValue[0] == '\1' && - newValue[0] != '\1') { + oldValue[0] == '1' && + newValue[0] != '1') { // clipboard oldValue = ''; }