6.6.2 - Alpha2 - 修复代码编辑器跳转行尾错位
This commit is contained in:
@@ -3,6 +3,7 @@ package org.autojs.autojs.ui.edit;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@@ -41,7 +42,7 @@ public class ClassSearchDialogBuilder extends MaterialDialog.Builder {
|
|||||||
|
|
||||||
public ClassSearchDialogBuilder(@NonNull Context context) {
|
public ClassSearchDialogBuilder(@NonNull Context context) {
|
||||||
super(new ContextThemeWrapper(context, R.style.AppTheme));
|
super(new ContextThemeWrapper(context, R.style.AppTheme));
|
||||||
mHandler = new Handler();
|
mHandler = new Handler(Looper.getMainLooper());
|
||||||
initViews(getContext());
|
initViews(getContext());
|
||||||
AndroidClassIndices.getInstance(getContext());
|
AndroidClassIndices.getInstance(getContext());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,20 +250,27 @@ class CodeEditor : HVScrollView {
|
|||||||
val layout = codeEditText.layout
|
val layout = codeEditText.layout
|
||||||
val line = LayoutHelper.getLineOfChar(layout, minOf(codeEditText.selectionStart, codeEditText.selectionEnd))
|
val line = LayoutHelper.getLineOfChar(layout, minOf(codeEditText.selectionStart, codeEditText.selectionEnd))
|
||||||
if (line >= 0 && line < layout.lineCount) {
|
if (line >= 0 && line < layout.lineCount) {
|
||||||
codeEditText.setSelection(layout.getLineEnd(line))
|
val lineEnd = layout.getLineEnd(line)
|
||||||
// codeEditText.setSelection(layout.getLineEnd(line) - 1)
|
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
|
mTheme = theme
|
||||||
setBackgroundColor(mTheme!!.backgroundColor)
|
setBackgroundColor(theme.backgroundColor)
|
||||||
mJavaScriptHighlighter.setTheme(theme)
|
mJavaScriptHighlighter.setTheme(theme)
|
||||||
val text = codeEditText.text
|
val text = codeEditText.text
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
mJavaScriptHighlighter.updateTokens(text.toString())
|
mJavaScriptHighlighter.updateTokens(text.toString())
|
||||||
}
|
}
|
||||||
codeEditText.setTheme(mTheme!!)
|
codeEditText.setTheme(theme)
|
||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Wed Jan 15 01:24:51 CST 2025
|
#Sat Jan 18 23:40:06 CST 2025
|
||||||
BUILD_TIME=1736875491255
|
BUILD_TIME=1737214806122
|
||||||
COMPILE_SDK_VERSION=34
|
COMPILE_SDK_VERSION=34
|
||||||
JAVA_VERSION=23
|
JAVA_VERSION=23
|
||||||
JAVA_VERSION_MIN_RADICAL=0
|
JAVA_VERSION_MIN_RADICAL=0
|
||||||
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
|
|||||||
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||||
TARGET_SDK_VERSION=34
|
TARGET_SDK_VERSION=34
|
||||||
TARGET_SDK_VERSION_INRT=29
|
TARGET_SDK_VERSION_INRT=29
|
||||||
VERSION_BUILD=2973
|
VERSION_BUILD=2976
|
||||||
VERSION_NAME=6.6.2 Alpha2
|
VERSION_NAME=6.6.2 Alpha2
|
||||||
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user