🐛 修复 BUG 出现滚动条后,退格可能会导致行号错位
This commit is contained in:
parent
967ad9343c
commit
0af9dd3dbd
4
pom.xml
4
pom.xml
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
<groupId>org.jcnc</groupId>
|
<groupId>org.jcnc</groupId>
|
||||||
<artifactId>JNotepad</artifactId>
|
<artifactId>JNotepad</artifactId>
|
||||||
<version>1.11.2-SNAPSHOT</version>
|
<version>1.1.3-bate</version>
|
||||||
<name>JNotepad</name>
|
<name>JNotepad</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|||||||
@ -25,7 +25,13 @@ import java.util.Map;
|
|||||||
public class PluginManager {
|
public class PluginManager {
|
||||||
private static final PluginManager INSTANCE = new PluginManager();
|
private static final PluginManager INSTANCE = new PluginManager();
|
||||||
Logger logger = LogUtil.getLogger(this.getClass());
|
Logger logger = LogUtil.getLogger(this.getClass());
|
||||||
|
/**
|
||||||
|
* 插件集合
|
||||||
|
*/
|
||||||
private final List<Plugin> plugins = new ArrayList<>();
|
private final List<Plugin> plugins = new ArrayList<>();
|
||||||
|
/**
|
||||||
|
* 插件类别
|
||||||
|
*/
|
||||||
private final Map<String, List<String>> categories = new HashMap<>();
|
private final Map<String, List<String>> categories = new HashMap<>();
|
||||||
|
|
||||||
private PluginManager() {
|
private PluginManager() {
|
||||||
|
|||||||
@ -79,7 +79,6 @@ public class LineNumberTextArea extends BorderPane {
|
|||||||
|
|
||||||
// 初始化监听器,用于处理事件
|
// 初始化监听器,用于处理事件
|
||||||
initListeners();
|
initListeners();
|
||||||
|
|
||||||
// 将主文本区域设置为中央内容,将行号区域设置为左侧内容
|
// 将主文本区域设置为中央内容,将行号区域设置为左侧内容
|
||||||
setCenter(mainTextArea);
|
setCenter(mainTextArea);
|
||||||
setLeft(lineNumberArea);
|
setLeft(lineNumberArea);
|
||||||
@ -202,10 +201,13 @@ public class LineNumberTextArea extends BorderPane {
|
|||||||
// 循环迭代,生成行号文本,
|
// 循环迭代,生成行号文本,
|
||||||
for (int i = 1; i <= numOfLines; i++) {
|
for (int i = 1; i <= numOfLines; i++) {
|
||||||
// 将行号和换行符添加到字符串中
|
// 将行号和换行符添加到字符串中
|
||||||
lineNumberText.append(i).append("\n");
|
lineNumberText.append(i);
|
||||||
|
if (i != numOfLines) {
|
||||||
|
lineNumberText.append("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将生成的行号文本设置到行号区域
|
// 将生成的行号文本设置到 行号区域
|
||||||
lineNumberArea.setText(lineNumberText.toString());
|
lineNumberArea.setText(lineNumberText.toString());
|
||||||
|
|
||||||
// 恢复主文本区域的垂直滚动位置
|
// 恢复主文本区域的垂直滚动位置
|
||||||
|
|||||||
@ -4,19 +4,21 @@
|
|||||||
-fx-vbar-policy: as-needed;
|
-fx-vbar-policy: as-needed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 不显示滚动条 */
|
/*!* 不显示滚动条 *!*/
|
||||||
|
/*.text-line-number .content {*/
|
||||||
|
/* -fx-cursor: text;*/
|
||||||
|
/* -fx-padding: 8px 1px 8px 5px;*/
|
||||||
|
/*}*/
|
||||||
.text-line-number .content {
|
.text-line-number .content {
|
||||||
-fx-cursor: text;
|
|
||||||
-fx-padding: 8px 1px 8px 5px;
|
-fx-padding: 8px 1px 8px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-line-number .scroll-bar:vertical {
|
.text-line-number .scroll-bar:vertical {
|
||||||
-fx-pref-width: 1;
|
-fx-pref-width: 1;
|
||||||
-fx-opacity: 0;
|
-fx-opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-line-number .scroll-bar:horizontal {
|
.text-line-number .scroll-bar:horizontal {
|
||||||
-fx-pref-height: 1;
|
-fx-pref-height: 10;
|
||||||
-fx-opacity: 0;
|
-fx-opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user