🐛 修复 BUG 出现滚动条后,退格可能会导致行号错位

This commit is contained in:
gewuyou 2023-09-12 18:44:10 +08:00
parent 967ad9343c
commit 0af9dd3dbd
4 changed files with 19 additions and 9 deletions

View File

@ -6,9 +6,9 @@
<groupId>org.jcnc</groupId>
<artifactId>JNotepad</artifactId>
<version>1.11.2-SNAPSHOT</version>
<version>1.1.3-bate</version>
<name>JNotepad</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -25,7 +25,13 @@ import java.util.Map;
public class PluginManager {
private static final PluginManager INSTANCE = new PluginManager();
Logger logger = LogUtil.getLogger(this.getClass());
/**
* 插件集合
*/
private final List<Plugin> plugins = new ArrayList<>();
/**
* 插件类别
*/
private final Map<String, List<String>> categories = new HashMap<>();
private PluginManager() {

View File

@ -79,7 +79,6 @@ public class LineNumberTextArea extends BorderPane {
// 初始化监听器用于处理事件
initListeners();
// 将主文本区域设置为中央内容将行号区域设置为左侧内容
setCenter(mainTextArea);
setLeft(lineNumberArea);
@ -202,7 +201,10 @@ public class LineNumberTextArea extends BorderPane {
// 循环迭代生成行号文本,
for (int i = 1; i <= numOfLines; i++) {
// 将行号和换行符添加到字符串中
lineNumberText.append(i).append("\n");
lineNumberText.append(i);
if (i != numOfLines) {
lineNumberText.append("\n");
}
}
// 将生成的行号文本设置到 行号区域

View File

@ -4,19 +4,21 @@
-fx-vbar-policy: as-needed;
}
/* 不显示滚动条 */
/*!* 不显示滚动条 *!*/
/*.text-line-number .content {*/
/* -fx-cursor: text;*/
/* -fx-padding: 8px 1px 8px 5px;*/
/*}*/
.text-line-number .content {
-fx-cursor: text;
-fx-padding: 8px 1px 8px 5px;
}
.text-line-number .scroll-bar:vertical {
-fx-pref-width: 1;
-fx-opacity: 0;
}
.text-line-number .scroll-bar:horizontal {
-fx-pref-height: 1;
-fx-pref-height: 10;
-fx-opacity: 0;
}