Skip to content

tabs breaking paren matching #131

numberten opened this Issue Feb 4, 2014 · 6 comments

3 participants


Parentheses matching breaks when tab characters are used. Explanation and possible solution:

11:22 < numberten> technomancy: the lein repl does this thing where it goes back momentarily to your opening paren when you enter a closing paren. and that feature is bugged with tabs
11:22 < technomancy> numberten: oh, gotcha
11:22 < numberten> it calculates go-back distance based on characters entered and since tabs take up way more space it breaks
11:22 < technomancy> numberten: bleaugh
11:22 < technomancy> numberten: pretty sure that's a jline2
11:23 < technomancy> *jline2 bug though
11:23 < numberten> i see
11:23 < technomancy> I'd love to just prevent the insertion of tabs entirely though
11:23 < numberten> just figured it might be easier to handle lein side if there was a config file
11:24 < technomancy> numberten: we might be able to add a workaround in lein, yeah
11:24 < technomancy> by binding tab to insert two spaces
11:24 < technomancy> even though the bug itself is in jline


Hmm, that's pretty strange, and yeah I agree with @technomancy - definitely a jline issue.

How are you getting tabs into the REPL? Copy/paste? What version of Leiningen, OS, terminal, and shell are you using?

I haven't been able to reproduce this in any released versions of REPLy, even by pasting tabs. I assume this is because tab triggers completion. Due to jline/jline2@2766027, if I actually go into the code and .setCopyPasteDetection to true on the ConsoleReader, I can get this to happen. But REPLy doesn't set that by default. Perhaps there's some way that I don't know about to put tab literals into REPLy without pasting them or hitting the tab key?


I'm using Leiningen 2.3.4
Ubuntu 13.10
Terminator (

I'm using alt+tab to tab.


I get the same behaviour in gnome-terminal.
In xterm, alt+tab doesn't seem to print tabs, but multiple tabs followed by a backspace seems to make it jump forward.


Cool, yeah, I see that with alt-tab now too, had no idea one could do that.

This is actually way deeper than just paren-matching in jline - beginning-of-line/end-of-line don't work in the presence of tab characters either. I'd encourage you to submit a bug report at - I guess the easy route for jline would be to compress tab characters to only take up 1 column in the console line it manages, but I'm not sure whether that's possible.

@numberten numberten referenced this issue in jline/jline2 Feb 4, 2014

tab characters skewing column index #129


Is there any way we could configure our usage of jline to treat tab insertions as spaces when it's not doing completion?


Not that I can think of, though that'd be nice. The only thing that comes to mind is terrible: some sort of intermediate stream between us & jline where we change tab characters to spaces. But (a) that's evil and (b) it would break completion.

I was pleasantly surprised to see that there is some notion of TAB_WIDTH in jline, so it probably means that needs to be taken into account in viMatch() (which paren matching uses), moveToEnd (end-of-line), and probably other places as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.