vlsi commented on code in PR #6359:
URL: https://github.com/apache/jmeter/pull/6359#discussion_r2523807090
##########
src/core/src/main/java/org/apache/jmeter/gui/util/JSyntaxTextArea.java:
##########
@@ -294,6 +295,30 @@ protected RUndoManager createUndoManager() {
return undoManager;
}
+ // Default limited to 110K
+ private static final int MAX_LINE_SIZE =
+ JMeterUtils.getPropDefault("view.results.tree.max_line_size",
110_000); // $NON-NLS-1$
+
+ // Limit the soft wrap to 100K (hard limit divided by 1.1)
+ private static final int SOFT_WRAP_LINE_SIZE =
+
JMeterUtils.getPropDefault("view.results.tree.soft_wrap_line_size", (int)
(MAX_LINE_SIZE / 1.1f)); // $NON-NLS-1$
+
+ private static String wrapLongLines(String input) {
+ if (input == null || input.isEmpty()) {
+ return input;
+ }
+ if (SOFT_WRAP_LINE_SIZE > 0 && MAX_LINE_SIZE > 0) {
+ StringWrap stringWrap = new StringWrap(SOFT_WRAP_LINE_SIZE,
MAX_LINE_SIZE);
+ return stringWrap.wrap(input, "\n");
+ }
+ return input;
+ }
+
+ @Override
+ public void setText(String t) {
+ super.setText(wrapLongLines(t));
Review Comment:
WDYT of
`org.apache.jmeter.visualizers.ViewResultsFullVisualizer.wrapLongLines(t)`?
It might make sense moving `wrapLongLines` to a different class.
##########
src/core/src/main/java/org/apache/jmeter/gui/util/JSyntaxTextArea.java:
##########
@@ -294,6 +295,30 @@ protected RUndoManager createUndoManager() {
return undoManager;
}
+ // Default limited to 110K
+ private static final int MAX_LINE_SIZE =
+ JMeterUtils.getPropDefault("view.results.tree.max_line_size",
110_000); // $NON-NLS-1$
+
+ // Limit the soft wrap to 100K (hard limit divided by 1.1)
+ private static final int SOFT_WRAP_LINE_SIZE =
+
JMeterUtils.getPropDefault("view.results.tree.soft_wrap_line_size", (int)
(MAX_LINE_SIZE / 1.1f)); // $NON-NLS-1$
Review Comment:
Why duplicating the properties? I guess those properties are not needed here
##########
src/jorphan/src/main/java/org/apache/jorphan/util/StringWrap.java:
##########
@@ -126,7 +126,7 @@ public String wrap(String input, String delimiter) {
}
// Try adding the next line if it does not exceed maxWrap
int next = nextLineSeparator;
- if (next != -1 && pos - next <= maxWrap) {
+ if (next != -1 && next - pos <= maxWrap) {
Review Comment:
Do we have a test to cover the change?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]