mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-13 05:54:01 +01:00
Fix tooltip formatting so it actually occurs.
This commit is contained in:
parent
021d3c3ae0
commit
b4b3399a4b
@ -47,17 +47,20 @@ public class TooltipHelper {
|
|||||||
for (int i = 0; i < indent; i++)
|
for (int i = 0; i < indent; i++)
|
||||||
lineStart += " ";
|
lineStart += " ";
|
||||||
|
|
||||||
String[] words = s.split(" ");
|
// Apply markup
|
||||||
|
String markedUp = s.replaceAll("_([^_]+)_", highlightColor + "$1" + defaultColor);
|
||||||
|
|
||||||
|
String[] words = markedUp.split(" ");
|
||||||
List<String> lines = new ArrayList<>();
|
List<String> lines = new ArrayList<>();
|
||||||
StringBuilder currentLine = new StringBuilder(lineStart);
|
StringBuilder currentLine = new StringBuilder(lineStart);
|
||||||
|
String word;
|
||||||
boolean firstWord = true;
|
boolean firstWord = true;
|
||||||
|
boolean lastWord;
|
||||||
|
|
||||||
|
// Apply hard wrap
|
||||||
for (int i = 0; i < words.length; i++) {
|
for (int i = 0; i < words.length; i++) {
|
||||||
String word = words[i];
|
word = words[i];
|
||||||
if (word.matches("_.+_.?"))
|
lastWord = i == words.length - 1;
|
||||||
word = highlightColor + word.replaceAll("\\_", "") + defaultColor;
|
|
||||||
|
|
||||||
boolean lastWord = i == words.length - 1;
|
|
||||||
|
|
||||||
if (!lastWord && !firstWord && currentLine.length() + word.length() > maxCharsPerLine) {
|
if (!lastWord && !firstWord && currentLine.length() + word.length() > maxCharsPerLine) {
|
||||||
lines.add(currentLine.toString());
|
lines.add(currentLine.toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user