macvim-dev / macvim-dev/macvim

Newly created gvim window not focused, existing gvim window is focused instead

Open
#1,156 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vim Script
Stars
7.9k
Forks
691
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
When creating a new gvim window via terminal gvim command, sometimes the new pop-up window doesn't gain focus, instead, the pre-existing gvim window is focused. This causes minor annoyance because user would intuitively think he/she is typing into the new window without checking.

I suspect it has something to do with multi-monitor environment and each monitor has a separate desktop number. Sometimes I typed gvim in the terminal and the new gvim window was opened in another monitor. And in that case often the wrong window was focused. Maybe macvim will focus window instance on the desktop with lowest index number?

Not sure if this is related to #83.

I didn't find out the pattern to reliably reproduce the behavior yet.

To Reproduce
Detailed steps to reproduce the behavior:

  1. Open a terminal.
  2. Type gvim.
  3. A new gvim instance popped up.
  4. But the original gvim instance is focused.

Expected behavior
The new gvim instance is focused.

Environment (please complete the following information):

  • Vim version: 8.2.2164
  • OS: macOS 11.1
  • Terminal: iTerm2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the focus issue with the terminal gvim command on macOS 11.1, especially with multiple monitors and desktops, and compare the behavior with issue #83. The work is done when a newly created gvim window consistently receives focus instead of an existing gvim window.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, vim
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.