Skip to content

Wrong cursor placement and selection when using mouse #993

Description

@0xDP

Describe the bug
Clicking with the mouse beyond the end of a line not always put the cursor at the last character. When selecting a whole line with the mouse, the selection stops at the same position as when clicking beyond the end of the line.

To Reproduce
Detailed steps to reproduce the behavior:

  1. Run mvim -u NONE -U NONE -c ':help ls'
  2. Click beyond the line starting with "Each buffer has a unique number."
  3. The cursor gets placed at the first "l" of "will"
  4. Select the whole line from the left to the right with the mouse. The selection stops at the same position, at the first "l" of "will".

Expected behavior
The cursor gets placed at the last character an the selection covers the whole line.

Screenshots
screenshot for 3. (the red arrow shows the position I've clicked):
Screenshot 2019-12-17 at 09 44 46

screenshot for 4.:
Screenshot 2019-12-17 at 09 46 35

Environment (please complete the following information):

VIM - Vi IMproved 8.1 (2018 May 18, compiled Nov 18 2019 19:04:21)
macOS version
Included patches: 1-2318
Compiled by dennis@coredump.d--p.de
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tcl
+arabic            +find_in_path      +mouse_xterm       +termguicolors
+autocmd           +float             +multi_byte        +terminal
+autochdir         +folding           +multi_lang        +terminfo
-autoservername    -footer            -mzscheme          +termresponse
+balloon_eval      +fork()            -netbeans_intg     +textobjects
+balloon_eval_term +fullscreen        +num64             +textprop
+browse            -gettext           +odbeditor         +timers
++builtin_terms    -hangul_input      +packages          +title
+byte_offset       +iconv             +path_extra        +toolbar
+channel           +insert_expand     -perl              +transparency
+cindent           +job               +persistent_undo   +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           -python            +visual
+cmdline_info      +libcall           -python3           +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
-cscope            +localmap          -ruby              +wildmenu
+cursorbind        -lua               +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con_gui    +mksession         +smartindent       -X11
+diff              +modify_fname      -sound             -xfontset
+digraphs          +mouse             +spell             +xim
+dnd               +mouseshape        +startuptime       -xpm
-ebcdic            +mouse_dec         +statusline        -xsmp
+emacs_tags        -mouse_gpm         -sun_workshop      -xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          +mouse_netterm     +tag_binary
+extra_search      +mouse_sgr         -tag_old_static
-farsi             -mouse_sysmouse    -tag_any_white
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno
-unknown-pragmas -pipe  -DMACOS_X -DMACOS_X_DARWIN  -Os -fno-caret-diagnostics
 -fno-color-diagnostics -fno-diagnostics-fixit-info -pipe -pedantic -Weverythi
ng -Wunused-macros -Wno-padded -Wno-format-nonliteral -Wno-switch-enum -Wno-co
vered-switch-default -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-reserved-
id-macro -Wno-disabled-macro-expansion -Wno-documentation-unknown-command -Wno
-documentation-deprecated-sync -Wsign-compare -U_FORTIFY_SOURCE -D_FORTIFY_SOU
RCE=1
Linking: clang    -o Vim -framework Cocoa -framework Carbon       -lm -lncurse
s  -liconv -framework AppKit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions