File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
compiler/src/dotty/tools/repl Expand file tree Collapse file tree 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):
7373 myClassLoader
7474 }
7575
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. */
8277 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)
8481 val showTruncated = " ... large output truncated, print value to show all"
8582 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
8885
8986 /** Return a String representation of a value we got from `classLoader()`. */
9087 private [repl] def replStringOf (value : Object )(using Context ): String =
You can’t perform that action at this time.
0 commit comments