Sunyanfei / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Hit Enter twice after make #378

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
(I'm deleting this from the forum and reporting it here)

The fact that the hit enter prompt is shown twice sometimes after :make when an 
error is found by quickfix was asked a number of times in the user list and in 
stackoverflow, but AFAIK it was just workarounded by making make silent or 
cmdheight larger. Now I've found a specific situation when the problem seem to 
be clearly reproducible: when the cursor was already on the line containing the 
first qf valid error immediately before running the make command (that is, the 
curaor was already on the line where make will automatically jump). In this 
case the qf error message is echoed as usual, except that the editor hasn't 
been redrawn yet and the hit enter prompt is presented again.

Original issue reported on code.google.com by carlosjo...@gmail.com on 24 Jun 2015 at 3:36

GoogleCodeExporter commented 9 years ago
To reproduce, try:

1) Write this simple 3-line python script:
#
#
1/0

2) let &l:errorformat='  File "%f"\, line %l%.%#' | let &l:makeprg='python %'

3a) Move the cursor to the first line and :make
  => Fine

3b) Move the cursor to the third line and :make
  => Double Hit Enter prompt

Notice the error is just empty because of the way errorformat was defined. The 
problem is not that the message is too long! (although, strangely enough, 
setting cmdheight to 2 supresses the extra prompt...)

There is another situation when the Hit Enter prompt is shown twice
and yet it's also unrelated to long messages: when there are no valid
entries in the qf list. In the example above, replace `1/0` for
`print('hello')` and repeat the steps. Now both 3a and 3b end up
showing a double prompt, despite there is nowhere to jump to and no
valid error message to show. 

Original comment by carlosjo...@gmail.com on 26 Jun 2015 at 2:58