import be.nikiroo.jvcard.Contact;
import be.nikiroo.jvcard.Data;
import be.nikiroo.jvcard.TypeInfo;
-import be.nikiroo.jvcard.i18n.Trans;
+import be.nikiroo.jvcard.launcher.Main;
+import be.nikiroo.jvcard.resources.StringUtils;
+import be.nikiroo.jvcard.resources.Trans;
import be.nikiroo.jvcard.tui.KeyAction;
import be.nikiroo.jvcard.tui.KeyAction.DataType;
import be.nikiroo.jvcard.tui.KeyAction.Mode;
-import be.nikiroo.jvcard.tui.StringUtils;
-import be.nikiroo.jvcard.tui.UiColors;
import be.nikiroo.jvcard.tui.UiColors.Element;
import com.googlecode.lanterna.input.KeyType;
public String getDefaultAnswer() {
Data data = getData();
if (data != null) {
- return data.getValue();
+ return data.getRawValue().replaceAll("\n", "\\\\n");
}
return null;
public String callback(String answer) {
Data data = getData();
if (data != null) {
- data.setValue(answer);
+ data.setRawValue(answer.replaceAll("\\\\n", "\n"));
return null;
}
StringBuilder valueBuilder = new StringBuilder(" ");
if (!extMode) {
- valueBuilder.append(data.getValue());
+ valueBuilder.append(data.getValue().replaceAll("\n", "\\\\n"));
if (data.getGroup() != null && data.getGroup().length() > 0) {
valueBuilder.append("(");
valueBuilder.append(data.getGroup());
value = valueBuilder.toString();
- name = StringUtils.sanitize(name, UiColors.getInstance().isUnicode());
- value = StringUtils.sanitize(value, UiColors.getInstance().isUnicode());
+ name = StringUtils.sanitize(name, Main.isUnicode());
+ value = StringUtils.sanitize(value, Main.isUnicode());
name = StringUtils.padString(name, SIZE_COL_1);
group = StringUtils.padString(group, SIZE_COL_2_OPT);
if (builder == null)
builder = new StringBuilder();
- for (int indexType = 0; indexType < data.size(); indexType++) {
- TypeInfo type = data.get(indexType);
+ for (TypeInfo type : data) {
if (builder.length() > 1)
builder.append(", ");
builder.append(type.getName().replaceAll(",", "\\,"));