Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange mouse problem #1689

Closed
mg979 opened this issue Jul 1, 2018 · 13 comments
Closed

strange mouse problem #1689

mg979 opened this issue Jul 1, 2018 · 13 comments
Labels

Comments

@mg979
Copy link

mg979 commented Jul 1, 2018

Information

VIM version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 9 2018 23:29:27)
Patch incluse: 1-1806.

Operating System: linux debian stretch

:ALEInfo

Current Filetype: vim
Available Linters: ['vint']
Enabled Linters: ['vint']
Suggested Fixers:
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:

let g:ale_vim_vint_executable = 'vint'
let g:ale_vim_vint_show_style_issues = 1
Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_lint_on_insert_leave = 0
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = 0
let g:ale_list_window_size = 10
let g:ale_list_vertical = 0
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = {}
let g:ale_pattern_options_enabled = 0
let g:ale_set_balloons = 1
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:

(executable check - failure) vint
(executable check - failure) vint

What went wrong

Using the mouse before a command leads to erratic behaviours: can't yank lines, pressing d deletes a line instead of waiting for a motion, and normal d +leftclick to delete up to cursor doesn't work anymore.

Reproducing the bug

Steps for repeating the bug:

Tested in viml and python, also with minimal vimrc, I can reproduce it easily by doing:

  1. left click somewhere
  2. yy
  3. left click somewhere else
  4. d
  5. either immediately or after a short delay, the line is deleted.
  6. repeat 3-4, 5 should happen again

I'm sure it's this plugin because it reverts to normal behaviour if I disable it. In neovim the bug doesn't seem to happen, though.

I started having this problem after last time I updated the plugins with vim-plug, but I had not updated them for a while, before that.

@w0rp
Copy link
Member

w0rp commented Jul 1, 2018

Could you try disabling all other plugins and repeating your steps again?

@mg979
Copy link
Author

mg979 commented Jul 1, 2018

It happens with this minimal vimrc:

let mapleader = "\\"
let maplocalleader = "\\"
set nocompatible

call plug#begin('~/.vim/plugged')
Plug 'w0rp/ale'
call plug#end()
set mouse=a

@szero
Copy link
Contributor

szero commented Jul 1, 2018

@mg979 What terminal emulator are you using and also what's your ttymouse variable set to?
Check with :set ttymouse?

@mg979
Copy link
Author

mg979 commented Jul 1, 2018

I'm using xfce4-terminal, set ttymouse=sgr
It doesn't happen in neovim and I can't test it on a previous vim 8 version (mine is compiled from source and nvim 0.2.2 seem to have replaced /usr/bin/vim)

@szero
Copy link
Contributor

szero commented Jul 1, 2018

Try setting ttymouse to xterm and check if your mouse is operational. I think this is vim bug because when I use mouse with sgr option my vim is segfaulting, I also compile vim quite often.

@mg979
Copy link
Author

mg979 commented Jul 1, 2018

Thanks, set ttymouse=xterm seems to work :). At least d + leftclick works normally, so I guess does the rest.

@mg979
Copy link
Author

mg979 commented Jul 2, 2018

I found another solution that is better for me, because mouse is a bit wonky with set ttymouse=xterm.

Instead I set

let g:ale_set_balloons = 0

@w0rp
Copy link
Member

w0rp commented Jul 2, 2018

Thank you @szero for the suggestion. It sounds like this might be a Vim bug which ALE can trigger by running the right code from balloon functions. I might file an issue on the Vim repo for this if I can repeat the bug myself with a minimal example.

@smhc
Copy link

smhc commented Jul 13, 2018

Mouse support is also broken for me when using:

 putty-latest-snapshot
 linux
 vim-latest (commit e76c4b237d41d0e62ca5d4fc76d1dd163fe222c0)
 ale, latest 
 g:ale_set_balloons=1
 TERM=putty-256color (although I've tried many other settings, including screen-256color)

My .vimrc has just:

set mouse=a
set ttymouse=sgr
packloadall

And ale (and only ale) is loaded as a plugin via vim pack feature.

Interestingly if I start a tmux session with mouse support enabled ('set -g mouse on' in .tmux.conf) the mouse works ok inside tmux. Within the tmux session,TERM=screen-256color.

Note I cannot get terminal mouse balloons working with any script.
But with ale and g:ale_set_balloons=1, the mouse doesn't work at all (except within tmux)

@w0rp
Copy link
Member

w0rp commented Jul 13, 2018

I think this is a bug in Vim, not in ALE. All ALE does is show balloons using balloonexpr. I think someone should report a bug in Vim so it detects a better default for ttymouse.

@szero
Copy link
Contributor

szero commented Aug 9, 2018

@smhc Could you try my workaround for no balloons problem? I was going through issues on official vim repo and some user pointed out that he managed to get balloons working in terminals by wrapping the balloon_show function inside the timer_start function and thus running it asynchronously. It works for me inside and outside tmux session. I'm using Debian Testing.

@smhc
Copy link

smhc commented Aug 12, 2018

@szero - my problem is that when the balloon support is enabled in ALE the mouse doesn't work for anything in vim, i.e resizing windows etc. It may be a bug with vim + enabled balloons + putty, rather than a bug with ALE specifically.

As I am using putty, balloon support in general is broken as putty does not support mouse tracking (yet). The escape sequences used to turn on mouse tracking is currently unsupported, which may explain why the mouse can't be used for anything when balloon functionality is enabled via ALE. So I am unable to test whether balloons are 'fixed'.

Due to balloon support being unsupported in my terminal I am better off with it disabled in ALE anyway.

@w0rp
Copy link
Member

w0rp commented Aug 13, 2018

I think there's a big with balloonexpr in Vim where just setting balloonexpr causes some weird mouse behavior if ttymouse isn't set to something that doesn't match the terminal. For that reason, I turned the setting off by default for terminals, and people can turn it on and play with their mouse settings if they want to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants