Skip to content
This repository was archived by the owner on Mar 26, 2019. It is now read-only.

Commit 5ae78e5

Browse files
committed
如果输入字符长度超过了文章长度,就跳过。
1 parent c69cc48 commit 5ae78e5

File tree

2 files changed

+37
-22
lines changed

2 files changed

+37
-22
lines changed

.idea/workspace.xml

Lines changed: 32 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/me/ryan/controller/TextController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,16 @@ private void updateText() {
122122
String[] inputText = Utils.codepoint2Strings(
123123
textInputArea.getText().codePoints().toArray());
124124

125-
var textList = textShowArea.getChildren();
126-
127125
// code point, 字符数
128126
int inputLengthNow = inputText.length;
129127

130-
131128
logger.debug("inputLengthLast:{}, inputLengthNow:{}", inputLengthLast, inputLengthNow);
132129

130+
var textList = textShowArea.getChildren();
131+
132+
// 如果输入字符长度超过了文章长度,就跳过。
133+
if (inputLengthNow > textList.size()) return;
134+
133135
if (inputLengthLast < inputLengthNow) {
134136
// 1. 更新字符数
135137
int count = inputLengthNow - inputLengthLast;

0 commit comments

Comments
 (0)