Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ public void addText(String text) {
}

public void onChanged(String newText) {
int length = newText.length();
if (this.firstCharacterIndex > length) {
this.firstCharacterIndex = length;
}
if (this.responder != null) {
this.responder.accept(newText);
}
Expand Down Expand Up @@ -409,7 +413,7 @@ public void renderBorder(PoseStack matrices) {
public void render(PoseStack matrices, int mouseX, int mouseY, float delta) {
if (this.isVisible()) {
this.renderBorder(matrices);

int color = this.editable ? this.editableColor : this.notEditableColor;
int int_4 = this.cursorPos - this.firstCharacterIndex;
int int_5 = this.highlightPos - this.firstCharacterIndex;
Expand Down Expand Up @@ -582,7 +586,7 @@ public void setHighlightPos(int highlightPos) {
if (this.firstCharacterIndex > j) {
this.firstCharacterIndex = j;
}

int width = this.getWidth();
String clippedText = this.font.plainSubstrByWidth(this.text.substring(this.firstCharacterIndex), width);
int int_4 = clippedText.length() + this.firstCharacterIndex;
Expand Down