Ensure line breaks are kept when replying to a multi line comment
Add a leading space to each quoted line to ensure that line breaks are kept. If the existing line breaks are kept it can happen that some lines get very long (e.g. if a whole paragraph was typed without an explicit line break). To avoid this long lines are automatically wrapped. Change-Id: I397e10f68908d85049abeb0e64cc923736f060bf Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -193,7 +193,24 @@ class ReplyBox extends Composite {
|
||||
m = m.substring(i + 1).trim();
|
||||
}
|
||||
}
|
||||
return "> " + m.replaceAll("\\n", "\\\n> ");
|
||||
StringBuilder quotedMsg = new StringBuilder();
|
||||
for (String line : m.split("\\n")) {
|
||||
line = line.trim();
|
||||
while (line.length() > 67) {
|
||||
int i = line.lastIndexOf(' ', 67);
|
||||
if (i < 50) {
|
||||
i = line.indexOf(' ', 67);
|
||||
}
|
||||
if (i > 0) {
|
||||
quotedMsg.append(" > ").append(line.substring(0, i)).append("\n");
|
||||
line = line.substring(i + 1);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
quotedMsg.append(" > ").append(line).append("\n");
|
||||
}
|
||||
return quotedMsg.toString().substring(0, quotedMsg.length() - 1); // remove last '\n'
|
||||
}
|
||||
|
||||
private void hide() {
|
||||
|
||||
Reference in New Issue
Block a user