Peter Waltman
2009-Nov-10 05:39 UTC
[R] How to remove/prevent trailing space after tab completion in R shell
Hi - Not a mission critical issue, but still highly annoying. I just upgraded R to 2.10.0 (the binary for Ubuntu karmic) and the tab completion facility now inserts a space after every completed term (something it didn't do in 2.9.0 or 2.9.2). It wouldn't be an issue so much if it weren't for the fact that it screws up tab-completing the next term, i.e. if I have a list of lists of something else, i.e. tmp.list <- list() tmp.list[[ "An.example" ]] <- list() tmp.list[[ "An.example" ]][[ "mat" ]] <- matrix( 10, nr=10, nc=1 ) using tab-completion to fill in the 'tmp.list$An.example" will result in a trailing space after the "$An.example" - "$An.example* *", requiring that it be deleted before the next term is specified. Any idea how to turn this off? Is this a shell integration issue? Something I'd need to do by compiling my own version? Thanks! Peter Waltman [[alternative HTML version deleted]]
Deepayan Sarkar
2009-Nov-10 11:36 UTC
[R] How to remove/prevent trailing space after tab completion in R shell
On Tue, Nov 10, 2009 at 11:09 AM, Peter Waltman <peter.waltman at gmail.com> wrote:> Hi - > > Not a mission critical issue, but still highly annoying. ?I just upgraded R > to 2.10.0 (the binary for Ubuntu karmic) and the tab completion facility now > inserts a space after every completed term (something it didn't do in 2.9.0 > or 2.9.2). ?It wouldn't be an issue so much if it weren't for the fact that > it screws up tab-completing the next term, i.e. if I have a list of lists of > something else, i.e. > tmp.list <- list() > tmp.list[[ "An.example" ]] <- list() > tmp.list[[ "An.example" ]][[ "mat" ]] <- matrix( 10, nr=10, nc=1 ) > > using tab-completion to fill in the 'tmp.list$An.example" will result in a > trailing space after the "$An.example" - "$An.example* *", requiring that it > be deleted before the next term is specified. > > Any idea how to turn this off? ?Is this a shell integration issue? > Something I'd need to do by compiling my own version?This is due to a "bugfix" in readline 6 (which I assume you are using). The current code sets rl_completion_append_character = '\0'; as part of the initialization step, and that worked with older versions of readline. But apparently the intended use was to do this every time completion is attempted, and one of the readline 6 changes is: Fixed a bug that caused the completion append character to not be reset to the default after an application-specified completion function changed it. I'll put in an appropriate fix after some testing. -Deepayan