File tree 1 file changed +6
-9
lines changed
compiler/src/dotty/tools/repl
1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -73,18 +73,15 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
73
73
myClassLoader
74
74
}
75
75
76
- /** Used to elide long output in replStringOf.
77
- *
78
- * TODO: Perhaps implement setting scala.repl.maxprintstring as in Scala 2, but
79
- * then this bug will surface, so perhaps better not?
80
- * https://github.com/scala/bug/issues/12337
81
- */
76
+ /** Used to elide long output in replStringOf. */
82
77
private [repl] def truncate (str : String )(using ctx : Context ): String =
83
- val maxPrintElements = ctx.settings.VreplMaxPrintElements .valueIn(ctx.settingsState)
78
+ // FIXME introduce a new setting `-Vrepl-max-print-characters` that allows to limit truncation by character properly
79
+ // see https://github.com/lampepfl/dotty/pull/16011#issuecomment-1245099657
80
+ val maxPrintCharacters = ctx.settings.VreplMaxPrintElements .valueIn(ctx.settingsState)
84
81
val showTruncated = " ... large output truncated, print value to show all"
85
82
val ncp = str.codePointCount(0 , str.length) // to not cut inside code point
86
- if ncp <= maxPrintElements then str
87
- else str.substring(0 , str.offsetByCodePoints(0 , maxPrintElements - 1 )) + showTruncated
83
+ if ncp <= maxPrintCharacters then str
84
+ else str.substring(0 , str.offsetByCodePoints(0 , maxPrintCharacters - 1 )) + showTruncated
88
85
89
86
/** Return a String representation of a value we got from `classLoader()`. */
90
87
private [repl] def replStringOf (value : Object )(using Context ): String =
You can’t perform that action at this time.
0 commit comments