emacsorphanage/git-gutter

Resizing windows to the right in the terminal is broken

jody-frankowski opened this issue · 8 comments

Hi,

There seems to be a bug with git-gutter that breaks the left-margin mouse-movement behavior.

Here is the smallest config that lets me reproduce the bug.

init.el:

(require 'package)
(package-initialize)

(setq package-archives '(("org"   . "http://orgmode.org/elpa/")
                            ("gnu"   . "http://elpa.gnu.org/packages/")
                            ("melpa" . "https://melpa.org/packages/")))
(package-refresh-contents)
(unless (package-installed-p 'use-package)
    (package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)

(xterm-mouse-mode)

(use-package git-gutter)
(global-git-gutter-mode)

(find-file "init.el")
(split-window-right)
(other-window 1)
(find-file "init.el")

Then execute the following:

git init
git add init.el
git commit -m "up"
echo '(message "hello")' >> init.el
emacs -nw -q --load init.el init.el

Then if you try to resize to the right you should have the following error:

<left-margin> <mouse-movement> is undefined

It sometimes work, but very rarely in my experience.
I haven't been able to reproduce this without git-gutter.

GNU Emacs 27.0.50
git-gutter-20161105.1356

It doesn't seem specific to git-gutter, though. I can reproduce this with linum-mode as well:

  1. emacs -nw -q
  2. M-x xterm-mouse-mode
  3. C-x b *scratch*
  4. C-x 3
  5. M-x linum-mode
  6. then try to resize to the right

Suggesting the issue occurs upstream somewhere?

I'm going to mark this as an "upstream" bug and leave it open.

I've just re-verified the same upstream bug exists in 27.0.91

I'm not really sure where linum-mode is supposed to fit in there.
I keep trying to disable linum-mode, with (global-linum-mode -1) for example, but the mode keeps showing up in (describe-mode), even though it doesn't seem to be "enabled" because no line numbers are shown.
Have you found a way to disable it in order to isolate it from git-gutter to make sure it's the source of the bug?

I’m just saying I can reproduce the issue with linum, which is a core Emacs package that also displays information in the left margin. That’s why I’m reporting it as an Emacs bug because it seems more likely the issue is somewhere in the window management part of Emacs.

... and in my comment above, where I run emacs -nw -q the -q means I'm disabling my initialization file so that git-gutter (and any other package I typically use) is not present during the test.

The Emacs maintainers fixed the upstream bug for the upcoming v28 release:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41156

I just compiled Emacs 28 from source and with that build I can't reproduce the bug.