Skip to content

Commit e5ccd70

Browse files
smarterretronym
andcommitted
Finer grained word boundaries for the REPL's line editor
Adapted from scala/scala#9017, this lets you edit: ``` scala> this.toString<ALT-BACKSPACE> ``` To: ``` scala> this. ``` Co-Authored-By: Jason Zaugg <[email protected]>
1 parent ff7673c commit e5ccd70

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/src/dotty/tools/repl/JLineTerminal.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import dotty.tools.dotc.util.SourceFile
99
import org.jline.reader
1010
import org.jline.reader.Parser.ParseContext
1111
import org.jline.reader._
12+
import org.jline.reader.impl.LineReaderImpl
1213
import org.jline.reader.impl.history.DefaultHistory
1314
import org.jline.terminal.TerminalBuilder
1415
import org.jline.utils.AttributedString
@@ -60,6 +61,8 @@ final class JLineTerminal extends java.io.Closeable {
6061
// this is supplied from the EOFError.getMissing() method
6162
.variable(LIST_MAX, 400) // Ask user when number of completions exceed this limit (default is 100).
6263
.variable(BLINK_MATCHING_PAREN, 0L) // Don't blink the opening paren after typing a closing paren.
64+
.variable(WORDCHARS,
65+
LineReaderImpl.DEFAULT_WORDCHARS.filterNot("*?.[]~=/&;!#%^(){}<>".toSet)) // Finer grained word boundaries
6366
.option(INSERT_TAB, true) // At the beginning of the line, insert tab instead of completing.
6467
.option(AUTO_FRESH_LINE, true) // if not at start of line before prompt, move to new line.
6568
.option(DISABLE_EVENT_EXPANSION, true) // don't process escape sequences in input

0 commit comments

Comments
 (0)