Skip to content

Commit

Permalink
Fix exception in text area when selecting text having first line empty,
Browse files Browse the repository at this point in the history
close #307
  • Loading branch information
kotcrab committed May 6, 2019
1 parent 3b68f82 commit 14ec102
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions ui/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#### Version: 1.4.3-SNAPSHOT (LibGDX 1.9.9)
- **Fixed**: Infinite loop in `PopupMenu` when trying to select next (or previous) `MenuItem` using keyboard and menu has no selectable `MenuItem`s.
- **Fixed**: [#307](https://github.com/kotcrab/vis-ui/issues/307) `ArrayIndexOutOfBounds` exception in `VisTextArea` when trying to select text having empty first line
- **Changed**: `PopupMenu` keyboard events will be now treated as handled by scene2d (they won't be passed to application under the stage)
- **Changed**: [#302](https://github.com/kotcrab/vis-ui/issues/302) `ToastManager` now allows to specify X and Y screen padding separately
- **Added**: `ToastManager#setScreenPaddingX(int)`, `ToastManager#setScreenPaddingY(int)`, `ToastManager#setScreenPadding(int, int)`, `ToastManager#getScreenPaddingX()`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected int letterUnderCursor (float x) {
int i = start;
for (; i < end; i++)
if (glyphPositions[i] > x) break;
if (glyphPositions[i] - x <= x - glyphPositions[i - 1]) {
if (i > 0 && glyphPositions[i] - x <= x - glyphPositions[i - 1]) {
return Math.min(i, text.length());
}
return Math.max(0, i - 1);
Expand Down

0 comments on commit 14ec102

Please # to comment.