Loading ...
Sorry, an error occurred while loading the content.

Automatic scrollbar causes column growth

Expand Messages
  • Michael Henry
    All, By default in Gvim, creating or destroying a vertical split causes the left-side scrollbar to automatically be created or destroyed. There appears to be
    Message 1 of 5 , Feb 23, 2013
    • 0 Attachment
      All,

      By default in Gvim, creating or destroying a vertical split
      causes the left-side scrollbar to automatically be created or
      destroyed. There appears to be some kind of timing-related bug
      wherein Gvim is not always able to maintain the value of
      'columns' at its original value.

      To demonstrate this, save the following snippet of VimL as
      ``scrollbar-column-growth.vim``::

      function! TestColumns()
      let c1=&columns
      wincmd v
      let c2=&columns
      wincmd o
      let c3=&columns
      sleep 250m
      echomsg c1 c2 c3 &columns
      endfunction
      map <silent> <Space> :call TestColumns()<CR>

      Then, invoke Gvim as::

      gvim -u NONE '+set nocp | source scrollbar-column-growth.vim'

      Each time the spacebar is pressed, the value of 'columns' will be
      displayed at four points in time. The first and last values show
      the initial and final 'columns' values. The bug doesn't always
      manifest itself with each keypress, but when the bug occurs, the
      final 'columns' value will have grown larger than the initial value.

      Try pressing spacebar multiple times in a row, then looking at
      the resulting :messages. Here is a sample run::
      80 80 80 80
      80 80 80 80
      80 80 82 82
      82 82 84 84
      84 84 86 86
      86 86 88 86
      86 86 86 86
      86 86 86 88

      As you can see, sometimes the 'columns' value is always correct,
      sometimes it goes up and comes back down (e.g., ``86 86 88
      86``), and sometimes it goes up permanently.

      I can work around the problem by removing the default ``L`` in
      'guioptions'; the bug manifests only when a scrollbar is setup
      to appear automatically using ``L`` or ``R``.

      This test was done on Fedora 17 Linux with a self-compiled Vim
      with :version output shown after my signature, but this is a
      problem that have been around for a long time (years, I think,
      but I've only just now isolated it to a somewhat repeatable
      test).

      Thanks,
      Michael Henry

      VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 23 2013 07:51:24)
      Included patches: 1-831
      Compiled by vim@...
      Huge version with GTK2 GUI. Features included (+) or not (-):
      +arabic -ebcdic +listcmds +persistent_undo
      +terminfo
      +autocmd +emacs_tags +localmap +postscript
      +termresponse
      +balloon_eval +eval -lua +printer
      +textobjects
      +browse +ex_extra +menu +profile +title
      ++builtin_terms +extra_search +mksession +python +toolbar
      +byte_offset +farsi +modify_fname -python3
      +user_commands
      +cindent +file_in_path +mouse +quickfix
      +vertsplit
      +clientserver +find_in_path +mouseshape +reltime
      +virtualedit
      +clipboard +float +mouse_dec +rightleft +visual
      +cmdline_compl +folding +mouse_gpm +ruby
      +visualextra
      +cmdline_hist -footer -mouse_jsbterm +scrollbind +viminfo
      +cmdline_info +fork() +mouse_netterm +signs
      +vreplace
      +comments +gettext +mouse_sgr +smartindent
      +wildignore
      +conceal -hangul_input -mouse_sysmouse -sniff
      +wildmenu
      +cryptv +iconv +mouse_urxvt +startuptime +windows
      +cscope +insert_expand +mouse_xterm +statusline
      +writebackup
      +cursorbind +jumplist +multi_byte -sun_workshop +X11
      +cursorshape +keymap +multi_lang +syntax
      -xfontset
      +dialog_con_gui +langmap -mzscheme +tag_binary +xim
      +diff +libcall +netbeans_intg +tag_old_static
      +xsmp_interact
      +digraphs +linebreak +path_extra -tag_any_white
      +xterm_clipboard
      +dnd +lispindent +perl -tcl
      -xterm_save
      system vimrc file: "$VIM/vimrc"
      user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
      system gvimrc file: "$VIM/gvimrc"
      user gvimrc file: "$HOME/.gvimrc"
      system menu file: "$VIMRUNTIME/menu.vim"
      fall-back for $VIM: "/usr/local/share/vim"
      Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread
      -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include
      -I/usr/include/atk-1.0 -I/usr/include/cairo
      -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
      -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
      -I/usr/include/pixman-1 -I/usr/include/freetype2
      -I/usr/include/libpng15 -I/usr/local/include -g -O2 -U_FORTIFY_SOURCE
      -D_FORTIFY_SOURCE=1
      Linking: gcc -L. -Wl,-z,relro -rdynamic -Wl,-export-dynamic
      -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE
      -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0
      -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0
      -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0
      -lSM -lICE -lXpm -lXt -lX11 -lSM -lICE -lm -ltinfo -lnsl -lselinux
      -lacl -lattr -lgpm -ldl -Wl,--enable-new-dtags
      -Wl,-rpath,/usr/lib64/perl5/CORE -fstack-protector
      -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil
      -lpthread -lc -L/usr/lib64/python2.7/config -lpython2.7 -lpthread -ldl
      -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lrt -ldl -lcrypt
      -lm

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • John Little
      ... My vim 7.3.820 on Kubuntu misbehaves much more than yours. All I have to do is press the space bar once, then away it goes, getting wider and wider, a
      Message 2 of 5 , Feb 23, 2013
      • 0 Attachment
        On Sunday, February 24, 2013 2:15:47 AM UTC+13, Michael Henry wrote:

        > Each time the spacebar is pressed, the value of 'columns' will be
        > displayed at four points in time.

        My vim 7.3.820 on Kubuntu misbehaves much more than yours. All I have to do is press the space bar once, then away it goes, getting wider and wider, a little unsteadily, till it reaches the width of my display, 237, where it bounces erratically between 237 and 238.
        If I change the map to noremap, or map a key not used in the mapping, the looping does not occur, and gvim's behaviour becomes predictable, in that the columns always go up by 1 in the fourth number. Now clearly gvim is looping for me with a recursive map, which shouldn't happen, because :map mappings don't apply on the command line, :map! ones do.

        If I start gvim -u NONE -N, and run :wincmd v then :wincmd o, the window size doesn't increase. But :wincmd v | windcmd o increases the width by one.

        It seems that after "wincmd v" gvim is confused as to what state it is in.

        Regards, John Little

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Michael Henry
        ... It sounds like you ve got a stray space character at the end of the :map command. I can replicate your results if I put a trailing space after the .
        Message 3 of 5 , Feb 24, 2013
        • 0 Attachment
          On 02/23/2013 07:16 PM, John Little wrote:
          > On Sunday, February 24, 2013 2:15:47 AM UTC+13, Michael Henry wrote:
          >
          >> Each time the spacebar is pressed, the value of 'columns' will be
          >> displayed at four points in time.
          >
          > My vim 7.3.820 on Kubuntu misbehaves much more than yours.
          > All I have to do is press the space bar once, then away it
          > goes, getting wider and wider, a little unsteadily, till it
          > reaches the width of my display, 237, where it bounces
          > erratically between 237 and 238.
          > If I change the map to noremap, or map a key not used in the
          > mapping, the looping does not occur, and gvim's behaviour
          > becomes predictable, in that the columns always go up by 1 in
          > the fourth number.

          It sounds like you've got a stray space character at the end of
          the :map command. I can replicate your results if I put a
          trailing space after the <CR>. I should have used :nnoremap
          instead of :map to avoid this kind of problem.

          > Now clearly gvim is looping for me with a
          > recursive map, which shouldn't happen, because :map mappings
          > don't apply on the command line, :map! ones do.

          I think this is explained by the fact that Vim goes back to
          normal mode after executing the ``:call TestColumns()<CR>`` part
          of the mapping.

          > If I start gvim -u NONE -N, and run :wincmd v then :wincmd o,
          > the window size doesn't increase. But :wincmd v | windcmd o
          > increases the width by one.

          Yes, there is definitely a timing component to this, which is
          why it fails only some of the time for me.

          Thanks for the verification. With a timing-dependent problem,
          it's not always a given that everyone can replicate it.

          Michael Henry

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • John Little
          ... Yes, you re right. If I paste text into vim from firefox, and the text does not end with a period or a newline, a space is appended :/, never noticed that
          Message 4 of 5 , Feb 24, 2013
          • 0 Attachment
            On Monday, February 25, 2013 2:18:02 AM UTC+13, Michael Henry wrote:
            > It sounds like you've got a stray space character at the end of
            > the :map command.

            Yes, you're right. If I paste text into vim from firefox, and the text does not end with a period or a newline, a space is appended :/, never noticed that before. I do sort of recall other posters on this list having stray spaces on the ends of mappings, perhaps this was the cause. Sorry to muddy your thread.

            Having fixed this, I do not see your unpredictability problem, all messages have the first three numbers the same (until the screen width is reached).

            Regards, John Little

            --
            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Charles Campbell
            ... Hello! Just wanted to note that I was able to duplicate something of this issue (using Scientific Linux 6.3). I hit space a lot, held it down a bit, etc.
            Message 5 of 5 , Mar 1, 2013
            • 0 Attachment
              Michael Henry wrote:
              > All,
              >
              > By default in Gvim, creating or destroying a vertical split
              > causes the left-side scrollbar to automatically be created or
              > destroyed. There appears to be some kind of timing-related bug
              > wherein Gvim is not always able to maintain the value of
              > 'columns' at its original value.
              >
              > To demonstrate this, save the following snippet of VimL as
              > ``scrollbar-column-growth.vim``::
              >
              > function! TestColumns()
              > let c1=&columns
              > wincmd v
              > let c2=&columns
              > wincmd o
              > let c3=&columns
              > sleep 250m
              > echomsg c1 c2 c3 &columns
              > endfunction
              > map <silent> <Space> :call TestColumns()<CR>
              >
              > Then, invoke Gvim as::
              >
              > gvim -u NONE '+set nocp | source scrollbar-column-growth.vim'
              >
              > Each time the spacebar is pressed, the value of 'columns' will be
              > displayed at four points in time. The first and last values show
              > the initial and final 'columns' values. The bug doesn't always
              > manifest itself with each keypress, but when the bug occurs, the
              > final 'columns' value will have grown larger than the initial value.
              >
              > Try pressing spacebar multiple times in a row, then looking at
              > the resulting :messages. Here is a sample run::
              > 80 80 80 80
              > 80 80 80 80
              > 80 80 82 82
              > 82 82 84 84
              > 84 84 86 86
              > 86 86 88 86
              > 86 86 86 86
              > 86 86 86 88
              >
              > As you can see, sometimes the 'columns' value is always correct,
              > sometimes it goes up and comes back down (e.g., ``86 86 88
              > 86``), and sometimes it goes up permanently.
              >
              > I can work around the problem by removing the default ``L`` in
              > 'guioptions'; the bug manifests only when a scrollbar is setup
              > to appear automatically using ``L`` or ``R``.
              >
              > This test was done on Fedora 17 Linux with a self-compiled Vim
              > with :version output shown after my signature, but this is a
              > problem that have been around for a long time (years, I think,
              > but I've only just now isolated it to a somewhat repeatable
              > test).
              >
              Hello!

              Just wanted to note that I was able to duplicate something of this issue
              (using Scientific Linux 6.3).
              I hit space a lot, held it down a bit, etc. I'd get straight 189s, then
              after quite a bit, I got 191s.

              Regards,
              Chip Campbell

              --
              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              ---
              You received this message because you are subscribed to the Google Groups "vim_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            Your message has been successfully submitted and would be delivered to recipients shortly.