git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cache save/load workflow
[fanfix.git]
/
src
/
be
/
nikiroo
/
utils
/
StringJustifier.java
diff --git
a/src/be/nikiroo/utils/StringJustifier.java
b/src/be/nikiroo/utils/StringJustifier.java
index 9ea0b7259282f6f4d8ab7a934fe039970aa47daf..ed202911e1f755d2e547bea905d5333e24a5e4e8 100644
(file)
--- a/
src/be/nikiroo/utils/StringJustifier.java
+++ b/
src/be/nikiroo/utils/StringJustifier.java
@@
-26,6
+26,9
@@
*
* @author Kevin Lamonte [kevin.lamonte@gmail.com]
* @version 1
*
* @author Kevin Lamonte [kevin.lamonte@gmail.com]
* @version 1
+ *
+ * I added some changes to integrate it here.
+ * @author Niki
*/
package be.nikiroo.utils;
*/
package be.nikiroo.utils;
@@
-220,8
+223,14
@@
class StringJustifier {
if ((i + 1) < line.length()) {
char car = line.charAt(i);
char nextCar = line.charAt(i + 1);
if ((i + 1) < line.length()) {
char car = line.charAt(i);
char nextCar = line.charAt(i + 1);
- if (
nextCar == ' ' || car == '-' || nextCar == '-
') {
+ if (
car == ' ' || car == '-' || nextCar == '
') {
needDash = false;
needDash = false;
+ } else if (i > 0) {
+ char prevCar = line.charAt(i - 1);
+ if (prevCar == ' ' || prevCar == '-') {
+ needDash = false;
+ i--;
+ }
}
}
}
}
@@
-238,8
+247,8
@@
class StringJustifier {
// no dash before parenthesis (but cannot add one more
// after)
if ((i + 1) < line.length()) {
// no dash before parenthesis (but cannot add one more
// after)
if ((i + 1) < line.length()) {
- char
c
ar = line.charAt(i + 1);
- if (
car == '(' || c
ar == ')') {
+ char
nextC
ar = line.charAt(i + 1);
+ if (
nextCar == '(' || nextC
ar == ')') {
needDash = false;
}
}
needDash = false;
}
}