!76 修复 BUG 修复当打开关联文件时多出一行行号的问题

Merge pull request !76 from 格物方能致知/fix-I7ZE89
This commit is contained in:
格物方能致知 2023-09-07 07:07:23 +00:00 committed by Gitee
commit 40e17cbe8c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 5 additions and 2 deletions

View File

@ -113,7 +113,10 @@ public class OpenFile implements EventHandler<ActionEvent> {
StringBuilder textBuilder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
textBuilder.append(line).append("\n");
if (!textBuilder.isEmpty()) {
textBuilder.append("\n");
}
textBuilder.append(line);
}
String text = textBuilder.toString();
LogUtil.getLogger(this.getClass()).info("已调用读取文件功能");

View File

@ -135,6 +135,7 @@ public class TopMenuBar extends MenuBar {
}
}
/**
* 初始化菜单栏
*/

View File

@ -122,7 +122,6 @@ public class LineNumberTextArea extends BorderPane {
*/
double mainTextAreaScrollTop = mainTextArea.getScrollTop();
double lineNumberAreaScrollTop = lineNumberArea.getScrollTop();
int numOfLines = mainTextArea.getParagraphs().size();
StringBuilder lineNumberText = new StringBuilder();
for (int i = 1; i <= numOfLines; i++) {