Error: E315, keepjumps, scrolloff

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Error: E315, keepjumps, scrolloff

Marko Mahnič
Error: E315, keepjumps, scrolloff

" To Reproduce:
" Add this file to plugins; start Vim.
" Open file A (eg. 100) lines and B (eg. 200) lines
" Do G on both files
" When switching from B to A (longer to shorter) the message
" It's a bug ... should appear (in :messages)
"
" The error caught is E315 on the line 'let toppos=line('.')
"
" The (funny) solution is:
"   let &scrolloff=&scrolloff
" (see the code below)

set scrolloff=3
function! ScrollOffBug()
   echom "ScrollOffBug?"
   " Solution:
   " let &scrolloff=&scrolloff
   try
      let pos = line('.')
      " error happens next:
      keepjumps norm! H
      let toppos = line('.')
    catch /.*/
       echom "It's a bug b=" . bufnr('%') . ", so=" . &scrolloff
    endtry
endfunc

au BufEnter * call ScrollOffBug()

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Error: E315, keepjumps, scrolloff

Bram Moolenaar

Marko Mahnic wrote:

> Error: E315, keepjumps, scrolloff
>
> " To Reproduce:
> " Add this file to plugins; start Vim.
> " Open file A (eg. 100) lines and B (eg. 200) lines
> " Do G on both files
> " When switching from B to A (longer to shorter) the message
> " It's a bug ... should appear (in :messages)
> "
> " The error caught is E315 on the line 'let toppos=line('.')
> "
> " The (funny) solution is:
> "   let &scrolloff=&scrolloff
> " (see the code below)
>
> set scrolloff=3
> function! ScrollOffBug()
>    echom "ScrollOffBug?"
>    " Solution:
>    " let &scrolloff=&scrolloff
>    try
>       let pos = line('.')
>       " error happens next:
>       keepjumps norm! H
>       let toppos = line('.')
>     catch /.*/
>        echom "It's a bug b=" . bufnr('%') . ", so=" . &scrolloff
>     endtry
> endfunc
>
> au BufEnter * call ScrollOffBug()

I can't reproduce it with the current Vim version.  What Vim version are
you using?

--
hundred-and-one symptoms of being an internet addict:
261. You find diskettes in your pockets when doing laundry.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Error: E315, keepjumps, scrolloff

Dominique Pellé
In reply to this post by Marko Mahnič
Marko Mahnič wrote:

> Error: E315, keepjumps, scrolloff
>
> " To Reproduce:
> " Add this file to plugins; start Vim.
> " Open file A (eg. 100) lines and B (eg. 200) lines
> " Do G on both files
> " When switching from B to A (longer to shorter) the message
> " It's a bug ... should appear (in :messages)
> "
> " The error caught is E315 on the line 'let toppos=line('.')
> "
> " The (funny) solution is:
> "   let &scrolloff=&scrolloff
> " (see the code below)
>
> set scrolloff=3
> function! ScrollOffBug()
>   echom "ScrollOffBug?"
>   " Solution:
>   " let &scrolloff=&scrolloff
>   try
>      let pos = line('.')
>      " error happens next:
>      keepjumps norm! H
>      let toppos = line('.')
>    catch /.*/
>       echom "It's a bug b=" . bufnr('%') . ", so=" . &scrolloff
>    endtry
> endfunc
>
> au BufEnter * call ScrollOffBug()


I'm not able to reproduce the bug you describe using
Vim-7.2.368 on Linux.   I see "ScrollOffBug?" but I never
see "It's a bug".

Which version of Vim are you using?

We may have different settings in ~/.vimrc.  So
can you try to reproduce it with "vim -u NONE"
and completely automate the way to reproduce it?

Thanks
-- Dominique

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Error: E315, keepjumps, scrolloff

Nikolay Aleksandrovich Pavlov
Ответ на сообщение «Re: Error: E315, keepjumps, scrolloff»,
присланное в 20:02:04 20 февраля 2010, Суббота,
отправитель Dominique Pellé:

I have this bug too. Completely automated way to reproduce with "vim -u NONE":
copy all attached files to one folder and run "sh bug.sh". Vim-7.2.303, Gentoo.

Текст сообщения:

> Marko Mahnič wrote:
> > Error: E315, keepjumps, scrolloff
> >
> > " To Reproduce:
> > " Add this file to plugins; start Vim.
> > " Open file A (eg. 100) lines and B (eg. 200) lines
> > " Do G on both files
> > " When switching from B to A (longer to shorter) the message
> > " It's a bug ... should appear (in :messages)
> > "
> > " The error caught is E315 on the line 'let toppos=line('.')
> > "
> > " The (funny) solution is:
> > "   let &scrolloff=&scrolloff
> > " (see the code below)
> >
> > set scrolloff=3
> > function! ScrollOffBug()
> >   echom "ScrollOffBug?"
> >   " Solution:
> >   " let &scrolloff=&scrolloff
> >   try
> >      let pos = line('.')
> >      " error happens next:
> >      keepjumps norm! H
> >      let toppos = line('.')
> >    catch /.*/
> >       echom "It's a bug b=" . bufnr('%') . ", so=" . &scrolloff
> >    endtry
> > endfunc
> >
> > au BufEnter * call ScrollOffBug()
>
> I'm not able to reproduce the bug you describe using
> Vim-7.2.368 on Linux.   I see "ScrollOffBug?" but I never
> see "It's a bug".
>
> Which version of Vim are you using?
>
> We may have different settings in ~/.vimrc.  So
> can you try to reproduce it with "vim -u NONE"
> and completely automate the way to reproduce it?
>
> Thanks
> -- Dominique
>

test (423 bytes) Download Attachment
testfile1 (21 bytes) Download Attachment
vimrc (41 bytes) Download Attachment
testfile2 (42 bytes) Download Attachment
bug.sh (329 bytes) Download Attachment
signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Error: E315, keepjumps, scrolloff

Nikolay Aleksandrovich Pavlov
In reply to this post by Bram Moolenaar
Ответ на сообщение «Re: Error: E315, keepjumps, scrolloff»,
присланное в 17:39:41 20 февраля 2010, Суббота,
отправитель Bram Moolenaar:

Could you try this script:
bug.sh:
=================================================================
vim -u NONE -c 'source bug.vim'
cat testoutput 2>/dev/null && echo "Bug exists!" || echo "No bug"
rm -f testoutput
=================================================================

bug.vim:
=================================================================
set nocompatible
set foldmethod=marker
set scrolloff=3
let s:bugmsg="It's a bug b=%i, so=%i"
let s:bugs=[]
function ScrollOffBug()
    try
        normal! H
    catch /.*/
        let s:bugs+=[printf(s:bugmsg, bufnr('%'), &scrolloff)]
        call writefile(s:bugs, "testoutput")
    endtry
endfunction
au BufEnter * call ScrollOffBug()
insert
abc
def
.
new
insert
abc
.
close!
normal! G
bnext!
normal! G
bnext!
qa!
" vim: ft=vim
=================================================================

Tested with vim-7.2.303.

Текст сообщения:

> Marko Mahnic wrote:
> > Error: E315, keepjumps, scrolloff
> >
> > " To Reproduce:
> > " Add this file to plugins; start Vim.
> > " Open file A (eg. 100) lines and B (eg. 200) lines
> > " Do G on both files
> > " When switching from B to A (longer to shorter) the message
> > " It's a bug ... should appear (in :messages)
> > "
> > " The error caught is E315 on the line 'let toppos=line('.')
> > "
> > " The (funny) solution is:
> > "   let &scrolloff=&scrolloff
> > " (see the code below)
> >
> > set scrolloff=3
> > function! ScrollOffBug()
> >    echom "ScrollOffBug?"
> >    " Solution:
> >    " let &scrolloff=&scrolloff
> >    try
> >       let pos = line('.')
> >       " error happens next:
> >       keepjumps norm! H
> >       let toppos = line('.')
> >     catch /.*/
> >        echom "It's a bug b=" . bufnr('%') . ", so=" . &scrolloff
> >     endtry
> > endfunc
> >
> > au BufEnter * call ScrollOffBug()
>
> I can't reproduce it with the current Vim version.  What Vim version are
> you using?
>

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Error: E315, keepjumps, scrolloff

Dominique Pellé
Hi

Thanks, I can now reproduce the E315 bug too using your
indications and Vim-7.2.368 on Linux.

I simplified the script a bit to use the 3 files
(testfile1, testfile2, test.vim) as follows:

$ cat testfile1
"{{{
    abc
"}}}

$ cat testfile2
"{{{
    abc
"}}}
"{{{
    def
"}}}

$ cat test.vim
set scrolloff=3 foldmethod=marker
au BufEnter * norm H
e testfile1
e testfile2
exe "norm G"
bp

$ vim -u NONE -c 'so test.vim'

... gives

Error detected while processing BufEnter Auto commands for "*":
E315: ml_get: invalid lnum: 6
E315: ml_get: invalid lnum: 5
E315: ml_get: invalid lnum: 4

-- Dominique

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php

test.vim (150 bytes) Download Attachment
testfile1 (28 bytes) Download Attachment
testfile2 (52 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Error: E315, keepjumps, scrolloff

Marko Mahnič
In reply to this post by Bram Moolenaar
On Feb 20, 3:39 pm, Bram Moolenaar <[hidden email]> wrote:
> I can't reproduce it with the current Vim version.  What Vim version are
> you using?

I tried it again. It seems that with the posted script the error only
happens when both buffers are folded.

I tried it with the following versions:

vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Dec 17 2009 21:59:10)
Included patches: 1-320
(compiled by me, with +python_screen, script 2606)

vim.basic --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Sep 21 2009 11:22:49)
Included patches: 1-245
(Ubuntu)

Marko

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Error: E315, keepjumps, scrolloff

Dominique Pellé
In reply to this post by Dominique Pellé
Dominique Pellé wrote:

> Hi
>
> Thanks, I can now reproduce the E315 bug too using your
> indications and Vim-7.2.368 on Linux.
>
> I simplified the script a bit to use the 3 files
> (testfile1, testfile2, test.vim) as follows:
>
> $ cat testfile1
> "{{{
>    abc
> "}}}
>
> $ cat testfile2
> "{{{
>    abc
> "}}}
> "{{{
>    def
> "}}}
>
> $ cat test.vim
> set scrolloff=3 foldmethod=marker
> au BufEnter * norm H
> e testfile1
> e testfile2
> exe "norm G"
> bp
>
> $ vim -u NONE -c 'so test.vim'
>
> ... gives
>
> Error detected while processing BufEnter Auto commands for "*":
> E315: ml_get: invalid lnum: 6
> E315: ml_get: invalid lnum: 5
> E315: ml_get: invalid lnum: 4


The script could be simplified a little bit further:

$ cat test.vim
set scrolloff=3 foldmethod=marker
au BufEnter * norm H
e testfile1
e testfile2
bp

$ vim -u NONE -c 'so test.vim'
E315: ml_get: invalid lnum: 6
E315: ml_get: invalid lnum: 5
E315: ml_get: invalid lnum: 4

Putting a breakpoint at the location of E315, I see this stack trace:

Breakpoint 1, ml_get_buf (buf=0x82104c0, lnum=6, will_change=0) at
memline.c:2103
2103    EMSGN(_("E315: ml_get: invalid lnum: %ld"), lnum);
(gdb) bt
#0  ml_get_buf (buf=0x82104c0, lnum=6, will_change=0) at memline.c:2103
#1  0x0810665b in plines_win_nofold (wp=0x820f538, lnum=6) at misc1.c:1732
#2  0x08106735 in plines_win_nofill (wp=0x820f538, lnum=6,
winheight=1) at misc1.c:1713
#3  0x081067a8 in plines_win (wp=0x820f538, lnum=6, winheight=1) at misc1.c:1679
#4  0x081067f2 in plines (lnum=6) at misc1.c:1667
#5  0x0810f8ab in cursor_correct () at move.c:2291
#6  0x0811e782 in nv_scroll (cap=0xbfffde5c) at normal.c:5780
#7  0x08123975 in normal_cmd (oap=0xbfffded0, toplevel=0) at normal.c:1188
#8  0x0809ff4e in exec_normal_cmd (cmd=0x832ce6d "H", remap=0,
silent=0) at ex_docmd.c:9194
#9  0x080a337c in ex_normal (eap=0xbfffe09c) at ex_docmd.c:9093
#10 0x080ab72e in do_one_cmd (cmdlinep=<value optimized out>,
sourcing=<value optimized out>,
    cstack=<value optimized out>, fgetline=0x80bd260 <getnextac>,
cookie=0xbfffe5b0) at ex_docmd.c:2627
#11 0x080a9b88 in do_cmdline (cmdline=0x0, getline=0x80bd260
<getnextac>, cookie=0xbfffe5b0, flags=7)
    at ex_docmd.c:1096
#12 0x080bcd29 in apply_autocmds_group (event=EVENT_BUFENTER,
fname=0x832e440 "/home/pel/bug/testfile1",
    fname_io=<value optimized out>, force=0, group=-3, buf=0x82104c0,
eap=0x0) at fileio.c:9077
#13 0x0805a375 in enter_buffer (buf=0x82104c0) at buffer.c:1425
#14 0x0805ab6b in do_buffer (action=0, start=0, dir=-1, count=1,
forceit=0) at buffer.c:1275
#15 0x0805b88b in goto_buffer (eap=0xbfffe7ac, start=0, dir=-1,
count=1) at buffer.c:695
#16 0x080a7ba8 in ex_bprevious (eap=0xbfffe7ac) at ex_docmd.c:4945
#17 0x080ab72e in do_one_cmd (cmdlinep=<value optimized out>,
sourcing=<value optimized out>,
    cstack=<value optimized out>, fgetline=0x809d480 <getsourceline>,
cookie=0xbfffed08) at ex_docmd.c:2627
#18 0x080a9b88 in do_cmdline (cmdline=0x83266e8 "set scrolloff=3
foldmethod=marker",
    getline=0x809d480 <getsourceline>, cookie=0xbfffed08, flags=7) at
ex_docmd.c:1096
#19 0x0809d9ca in do_source (fname=0x82ab693 "test.vim",
check_other=0, is_vimrc=0) at ex_cmds2.c:3206
#20 0x0809e095 in cmd_source (fname=0x82104c0 "\003", eap=0x0) at
ex_cmds2.c:2811
#21 0x080ab72e in do_one_cmd (cmdlinep=<value optimized out>,
sourcing=<value optimized out>,
    cstack=<value optimized out>, fgetline=0, cookie=0x0) at ex_docmd.c:2627
#22 0x080a9b88 in do_cmdline (cmdline=0xbffff6a8 "so test.vim",
getline=0, cookie=0x0, flags=11) at ex_docmd.c:1096
#23 0x080adfb9 in do_cmdline_cmd (cmd=0xbffff6a8 "so test.vim") at
ex_docmd.c:702
#24 0x080e61eb in exe_commands (argc=3, argv=0xbffff514) at main.c:2732
#25 main (argc=3, argv=0xbffff514) at main.c:887

(gdb) p buf
$12 = (buf_T *) 0x82104c0

(gdb) p curwin->w_buffer
$13 = (buf_T *) 0x82104c0

(gdb) p curwin->w_buffer->b_ml.ml_line_count
$14 = 3

(gdb) p curwin->w_botline
$15 = 7

(gdb) p /x curwin->w_valid
$17 = 0xe4


I think that curwin->w_valid has VALID_BOTLINE bit set
even though w_botline is not valid (it's bigger than the number
of lines in the buffer).

Following change avoids the E315 bug, but it's not
the correct way of fixing the bug yet.

$ hg diff move.c
diff -r 4bac7ed34007 src/move.c
--- a/src/move.c Thu Feb 18 15:53:29 2010 +0100
+++ b/src/move.c Sun Feb 21 11:13:01 2010 +0100
@@ -582,7 +582,7 @@
     void
 validate_botline()
 {
-    if (!(curwin->w_valid & VALID_BOTLINE))
+    /*if (!(curwin->w_valid & VALID_BOTLINE))*/
  comp_botline(curwin);
 }


I suppose that w_botline is updated incorrectly
somewhere, without invalidating it, but I don't know
where that would be yet.

-- Dominique

--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php