Bug 15791 - Autocomplete with TAB messes prompt
Summary: Autocomplete with TAB messes prompt
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Windows GUI / Window specific (show other bugs)
Version: R 3.1.2
Hardware: All All
: P5 major
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-05-04 01:29 UTC by caerolus
Modified: 2014-11-13 15:59 UTC (History)
5 users (show)

See Also:


Attachments
screencast showing the problem (267.56 KB, video/mp4)
2014-05-04 01:29 UTC, caerolus
Details
code completion bug - functions' arguments (51.13 KB, application/pdf)
2014-05-24 15:35 UTC, Marco Maier
Details
screencast of R 3.1.2 behaviour on invocation of autocomplete (117.95 KB, image/gif)
2014-11-04 11:27 UTC, spam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description caerolus 2014-05-04 01:29:04 UTC
Created attachment 1598 [details]
screencast showing the problem

When autocompleting with the TAB key the suggestions appear in the same line as the prompt, but remain there no matter what you do next. The result is that the suggestions are mixed with your actual input and you don't know what you're typing anymore.

I've attached a small screencast showing the problem.

Both x32 and x64 versions. Didn't happen on 3.0.0 (just updated to 3.1.0).
Comment 1 Martin Maechler 2014-05-06 09:53:51 UTC
(In reply to caerolus from comment #0)
> Created attachment 1598 [details]
> screencast showing the problem
> 
> When autocompleting with the TAB key the suggestions appear in the same line
> as the prompt, but remain there no matter what you do next. The result is
> that the suggestions are mixed with your actual input and you don't know
> what you're typing anymore.
> 
> I've attached a small screencast showing the problem.
> 
> Both x32 and x64 versions. Didn't happen on 3.0.0 (just updated to 3.1.0).

I can confirm the problem, with quite a few versions of R for Windows,
including 3.0.1, 3.0.2, a very recent snapshot of R devel ("3.2.0").

OTOH, the problem does *not* show on 2.15.2 (no 2.15.3 present).
Note that it may be a problem with the tools used to build R, rather than with R itself..
(The R versions above were all installed after downloading binaries from CRAN).
Comment 2 Duncan Murdoch 2014-05-18 11:23:26 UTC
I don't see this (but there are no instructions for reproduction in the bug report, so maybe I'm misinterpreting what was done in the video).

In Rgui, things appear to be fine.

In Rterm, I don't see what the video shows.  The choices aren't removed when one is chosen, so I see things like this:

> sum
sum                summary            summary.aov        summary.connection
summary.data.frame summary.Date       summary.default    summary.factor
summary.glm        summary.lm         summary.manova     summary.matrix
summary.POSIXct    summary.POSIXlt    summary.proc_time  summary.srcfile
summary.srcref     summary.stepfun    summary.table      summaryRprof
> summary.src
summary.srcfile summary.srcref
> summary.s
summary.srcfile summary.srcref  summary.stepfun

(I have hit tab at the end of each input line.)

This testing was done in R 3.1.0-patched, in an old XP shell runing CMD or Cygwin bash.
Comment 3 caerolus 2014-05-18 12:29:05 UTC
In the video, I just type "summary", and then press TAB repeatedly. The suggestions keep piling up in the promp.

This was Rgui 3.1.0, windows 7 64-bits.
Comment 4 Marco Maier 2014-05-24 15:35:37 UTC
Created attachment 1605 [details]
code completion bug - functions' arguments

I am also experiencing this bug in the Rgui since R 3.0.0 on pretty much any windows machine (win xp, 7 32-bit and 7, 8, 8.1 x64).

see "win_code_completion.pdf" for a step-by-step description (hopefully reproducable).

It seems like the code suggestion is missing a leading linebreak. when you try code completion to see function's arguments, like typing "glm(" and hitting "tab" twice, it looks like:

> glm(formula=   family=    data=      weights=   subset=    na.action= start= $
etastart=  mustart=   offset=    control=   model=     method=    x=
y=         contrasts= ...=

note that the first line extends beyond the set width. a linebreak after what's been typed would fix this:

> glm(
formula=   family=    data=      weights=   subset=    na.action= start=
etastart=  mustart=   offset=    control=   model=     method=    x=
y=         contrasts= ...=
> glm(

also it's a bit odd that the command prompt appears below the suggestions but disappears when you hit "tab" a third time or start to type anything.
if you only "tab", the first line of suggestions remains (now in red) until you start to type anything.

kind regards,
marco
Comment 5 spam 2014-08-02 20:57:55 UTC
Bug confirmed for R version 3.1.1 on Windows 7 (32bit). :-(
Comment 6 spam 2014-11-04 11:21:31 UTC
Bug is still present in version 3.1.2, win32

Added a new screencap for version 3.1.2
Comment 7 spam 2014-11-04 11:27:19 UTC
Created attachment 1679 [details]
screencast of R 3.1.2 behaviour on invocation of autocomplete

You can see the list of available objects in R's current workspace, I tried to autocomplete on the string "A5". 
R prints the two possible completions correctly, added a newline and returns to the prompt.
Then I tried to delete the two characters from the prompt and this apparently messed up the console: The prompt jumped back upwards one line and got mixed into the suggestions printed earlier.
Comment 8 Duncan Murdoch 2014-11-04 19:34:50 UTC
I can see this now.  The R GUI is not code that I like to modify, because it seems when you fix one bug, you end up with another.  However, I will fix the completion code in a way that works in limited testing, in R-devel only.  If people test it and tell me it's fine, I'll port it over to R-patched as well.
Try R-devel revision 66932 or newer to check it out.
Comment 9 Duncan Murdoch 2014-11-13 15:25:55 UTC
Hearing no reply to the request for testing, I'll leave this in R-devel but will not port to R-patched.
Comment 10 caerolus 2014-11-13 15:41:53 UTC
(In reply to Duncan Murdoch from comment #9)
> Hearing no reply to the request for testing, I'll leave this in R-devel but
> will not port to R-patched.

I'll test it right now. I understand that the version here http://cran.r-project.org/bin/windows/base/R-devel-win.exe should work, right?
Comment 11 caerolus 2014-11-13 15:59:29 UTC
(In reply to caerolus from comment #10)
> (In reply to Duncan Murdoch from comment #9)
> > Hearing no reply to the request for testing, I'll leave this in R-devel but
> > will not port to R-patched.
> 
> I'll test it right now. I understand that the version here
> http://cran.r-project.org/bin/windows/base/R-devel-win.exe should work,
> right?

I just tested version (2014-11-12 r66972), both i386 and x64, on Win 7 64. It seems to be fixed now, but a couple of times something happened. I'm not able to reproduce it, so can't tell you exactly how it happened.

I typed "summary." (or maybe just "summary", I don't recall), hit TAB once or twice, the suggestions showed up correctly below it, the prompt was now below the suggestions. If I keep writing, the suggestions and the lower prompt are removed and we are typing now in the upper prompt, ok. But if after showing the suggestions I backspace instead, a couple of times it did this: remove the suggestions but keep the blank space they occupied, keep the upper prompt, and stay in the lower prompt, with the removed letter there. Something like this:

> summary



> summar [prompt here]

Again, I'm not able to reproduce it, so I can't tell exactly how much I typed and how many times I pressed TAB and when. In any case, the major problem is solved and this new thing happened just a couple times, so I think it could ship as is.

Thanks a lot.