6.6.2 - Alpha2 - 修复代码编辑器跳转行尾错位

This commit is contained in:
SuperMonster003
2025-01-18 23:44:12 +08:00
parent 13ade9d022
commit 0c2c686022
3 changed files with 17 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ package org.autojs.autojs.ui.edit;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.widget.EditText;
@@ -41,7 +42,7 @@ public class ClassSearchDialogBuilder extends MaterialDialog.Builder {
public ClassSearchDialogBuilder(@NonNull Context context) {
super(new ContextThemeWrapper(context, R.style.AppTheme));
mHandler = new Handler();
mHandler = new Handler(Looper.getMainLooper());
initViews(getContext());
AndroidClassIndices.getInstance(getContext());
}

View File

@@ -250,20 +250,27 @@ class CodeEditor : HVScrollView {
val layout = codeEditText.layout
val line = LayoutHelper.getLineOfChar(layout, minOf(codeEditText.selectionStart, codeEditText.selectionEnd))
if (line >= 0 && line < layout.lineCount) {
codeEditText.setSelection(layout.getLineEnd(line))
// codeEditText.setSelection(layout.getLineEnd(line) - 1)
val lineEnd = layout.getLineEnd(line)
val text = codeEditText.text.toString()
val finalPosition = when {
lineEnd > 0 && text[lineEnd - 1] == '\n' -> {
lineEnd - 1
}
else -> lineEnd
}
codeEditText.setSelection(finalPosition)
}
}
fun setTheme(theme: Theme?) {
fun setTheme(theme: Theme) {
mTheme = theme
setBackgroundColor(mTheme!!.backgroundColor)
setBackgroundColor(theme.backgroundColor)
mJavaScriptHighlighter.setTheme(theme)
val text = codeEditText.text
if (text != null) {
mJavaScriptHighlighter.updateTokens(text.toString())
}
codeEditText.setTheme(mTheme!!)
codeEditText.setTheme(theme)
invalidate()
}

View File

@@ -1,5 +1,5 @@
#Wed Jan 15 01:24:51 CST 2025
BUILD_TIME=1736875491255
#Sat Jan 18 23:40:06 CST 2025
BUILD_TIME=1737214806122
COMPILE_SDK_VERSION=34
JAVA_VERSION=23
JAVA_VERSION_MIN_RADICAL=0
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=34
TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=2973
VERSION_BUILD=2976
VERSION_NAME=6.6.2 Alpha2
VSCODE_EXT_REQUIRED_VERSION=1.0.8