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
web server: can disable buttons
[fanfix.git]
/
src
/
jexer
/
TPasswordField.java
diff --git
a/src/jexer/TPasswordField.java
b/src/jexer/TPasswordField.java
index ea88dfa45f96761e868fa65236895fb8f22dde98..0be2b98ce3ff73e0a9668b621f2639df791f0c1d 100644
(file)
--- a/
src/jexer/TPasswordField.java
+++ b/
src/jexer/TPasswordField.java
@@
-29,10
+29,11
@@
package jexer;
import jexer.bits.CellAttributes;
package jexer;
import jexer.bits.CellAttributes;
-import jexer.bits.
GraphicsChar
s;
+import jexer.bits.
StringUtil
s;
/**
/**
- * TField implements an editable text field.
+ * TPasswordField implements an editable text field that displays
+ * stars/asterisks when it is not active.
*/
public class TPasswordField extends TField {
*/
public class TPasswordField extends TField {
@@
-111,15
+112,16
@@
public class TPasswordField extends TField {
}
int end = windowStart + getWidth();
}
int end = windowStart + getWidth();
- if (end >
text.length(
)) {
- end =
text.length(
);
+ if (end >
StringUtils.width(text
)) {
+ end =
StringUtils.width(text
);
}
}
- hLineXY(0, 0, getWidth(),
GraphicsChars.HATCH
, fieldColor);
+ hLineXY(0, 0, getWidth(),
backgroundChar
, fieldColor);
if (showStars) {
hLineXY(0, 0, getWidth() - 2, '*', fieldColor);
} else {
if (showStars) {
hLineXY(0, 0, getWidth() - 2, '*', fieldColor);
} else {
- putStringXY(0, 0, text.substring(windowStart, end), fieldColor);
+ putStringXY(0, 0, text.substring(screenToTextPosition(windowStart),
+ screenToTextPosition(end)), fieldColor);
}
// Fix the cursor, it will be rendered by TApplication.drawAll().
}
// Fix the cursor, it will be rendered by TApplication.drawAll().