Skip to content

Fix timer handling #749

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

Merged
merged 1 commit into from
Sep 22, 2018
Merged

Fix timer handling #749

merged 1 commit into from
Sep 22, 2018

Conversation

ichizok
Copy link
Member

@ichizok ichizok commented Sep 20, 2018

Problem

On GUI, timer callback can be delayed when the callback is called from job/channel callback.

Repro steps

sample.vim

function! TimerCb(timer)
  echo printf('elapsed: %f', reltimefloat(reltime(g:elapsed)))
endfunction

function! ExitCb(job, status)
  let g:elapsed = reltime()
  let g:timer = timer_start(1, 'TimerCb')
endfunction

let g:job = job_start(['true'], {'exit_cb': 'ExitCb'})
call repeat('A', 10000)

Start GUI MacVim:

mvim --clean -g

and do:

:so sample.vim

The message "elapsed: ..." does not show until any user-input (key, mouse, ..) given.
That is, TimerCb is delayed.

Cause

Timer callback does not execute in [MMBackend waitForInput].
Thus, when a timer is created in parse_queued_messaged() in gui_mch_wait_for_chars(), the timer is ignored while waiting for input.

Solution

  • Need check did_add_timer after parse_queued_messaged() in gui_mch_wait_for_chars().

@splhack splhack merged commit d716ad7 into macvim-dev:master Sep 22, 2018
@ichizok ichizok deleted the fix/timer-check branch September 22, 2018 09:09
ychin added a commit to ychin/macvim that referenced this pull request Dec 5, 2018
Vim patch 8.1.560

Targets macOS 10.8+

Features:
- macOS Mojave (10.14) is now supported.
    - MacVim's UI now works with Dark Mode.
    - Fixed broken rendering and flickering under Mojave when using the
      default Core Text renderer. macvim-dev#757
- guioption 'k' is supported again. macvim-dev#731
    - This option prevents window from resizing when UI elements such as
      toolbars or tabs show or hide themselves.

Fixes:
- Fixed misc fullscreen and window resizing bugs and artifacts macvim-dev#745
- Dragging tabs to reorder now works properly macvim-dev#789
- Fixed timer callback handling in GUI macvim-dev#749
- Fixed native tabs (10.12+) interring with Vim tabs macvim-dev#788
- Fixed Japanese IME Ctrl-U/Ctrl-O handling macvim-dev#742
- Fixed MMShareFindPboard and Cmd-E/Cmd-G interactions macvim-dev#780
- Better handling of guifontwide font size macvim-dev#737
- Better python discovery in default vimrc macvim-dev#739

Known Issues:
- Scrolling performance is slightly worse under Mojave macvim-dev#796

Script interfaces have compatibility with these versions:
- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.7
- Ruby 2.5
ychin added a commit that referenced this pull request Dec 5, 2018
Vim patch 8.1.560

Targets macOS 10.8+

Features:
- macOS Mojave (10.14) is now supported.
    - MacVim's UI now works with Dark Mode.
    - Fixed broken rendering and flickering under Mojave when using the
      default Core Text renderer. #757
- guioption 'k' is supported again. #731
    - This option prevents window from resizing when UI elements such as
      toolbars or tabs show or hide themselves.

Fixes:
- Fixed misc fullscreen and window resizing bugs and artifacts #745
- Dragging tabs to reorder now works properly #789
- Fixed timer callback handling in GUI #749
- Fixed native tabs (10.12+) interring with Vim tabs #788
- Fixed Japanese IME Ctrl-U/Ctrl-O handling #742
- Fixed MMShareFindPboard and Cmd-E/Cmd-G interactions #780
- Better handling of guifontwide font size #737
- Better python discovery in default vimrc #739

Known Issues:
- Scrolling performance is slightly worse under Mojave #796

Script interfaces have compatibility with these versions:
- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.7
- Ruby 2.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants