Stateful, fast renderer for MMCoreTextView by s4y · Pull Request #858 · macvim-dev/macvim

@s4y changed the title Stateful, fast renderer for MMCoreTextView [WIP] Stateful, fast renderer for MMCoreTextView

Feb 19, 2019

@s4y s4y mentioned this pull request

Feb 19, 2019

@s4y s4y changed the title [WIP] Stateful, fast renderer for MMCoreTextView Stateful, fast renderer for MMCoreTextView

May 1, 2019

@ychin ychin mentioned this pull request

Oct 18, 2020

ychin

@s4y

This change reworks `MMCoreTextView` to keep track of the state of the
screen instead of drawing to the screen or to an image. This lets
`drawRect:` draw any part of the view at any time, as needed.

This change came about when the old strategy stopped working: The old
strategy calls `drawRect:` for the entire view to handle any draw
command from the backend, but drew only the changes on top of the old
content of the view. This did not work in new versions of macOS that use
layers, because `drawRect:` is now expected to fill the entire rect with
new content. If it doesn't, the rest of the view will just contain
garbage. bbad3ed worked around this
issue by adding an intermediate CGImage which was preserved between
draws. This fixed the problem but made rendering slower.

With the change, the intermediate image is no longer needed and
rendering is much faster overall, which resolves macvim-dev#796.

As part of this change, font substitution is now handled by Core Text,
which changes which fallback fonts are used in some cases but matches
other macOS apps.

@ychin ychin added the Renderer

Text rendering issues, including CoreText renderer

label

Dec 10, 2020

ychin added a commit that referenced this pull request

Dec 11, 2020
Updated to Vim 8.2.2127.

*Note*: This release doesn't natively support Apple Silicon / M1 yet, but
does work under Rosetta. See below.

Features
====================

Big Sur / macOS 11
--------------------

- MacVim now has an updated app icon (#1054), and preference pane / toolbars
  have been updated to match Big Sur's interface guidelines. (#1128)
- Fixed Touch Bar warnings when launching MacVim from the terminal.
  #1114
- SF Symbol characters will show up properly as double-width as most of
  these icons would take up more than one column. Note that these
  characters are specific to macOS and would not work in other
  platforms. #1129

Renderer / scrolling performance improvements
--------------------

The Core Text renderer has been rewritten and is now much faster!
Scrolling should not stutter and lag like before and generally it should
feel a lot smoother now. Thanks to Sidney San Martín (@s4y) for the
contribution. #858

With this change, the non-Core-Text renderer is now considered
deprecated. The old renderer is accessible either through the Preference
Pane (under Advanced) or by setting the defaults "MMRenderer" to 0. It
works for now, but it will be removed in a future update as it has known
bugs.

Menu Localization
--------------------

Menus are now localized, see `:h langmenu` for how Vim menu localization
works. You can use `set langmenu=none` to turn it off if you would like. #1099

There still exists a few menu items that are not localized, and the
general MacVim GUI is not localized as well. If you would like to help,
please use #1102 to coordinate with MacVim dev team.

Getting help / Help menu
--------------------

- Help menu's search bar now searches Vim documentation as well! See
  #1095.
- Vimtutor is now bundled with MacVim, and you can access vimtutor from
  the Help menu (#1096). There is also a link to the latest release
  notes as well (#1131).

General
====================

- This release does not contain a native universal app for Apple Silicon
  / M1 Macs yet. The release binary will still work under Rosetta, which
  should provide enough performance, but if you use Python/etc plugins,
  you need to make sure you have x86 versions of Python/etc installed
  (which is still the default for Homebrew as of this release).

  MacVim is buildable under Apple Silicon, so if you need a native
  binary, you could build it yourself by downloading the source from the
  Github repository. See #1136 for progress on releasing a universal app
  for Apple Silicon.

- MacVim has enabled the Github Discussions feature, which serves as a
  good spot for general discussions and questions. See
  #1130 and check it
  out!

Fixes
====================

- Launching MacVim from the Dock with locales that use "," for decimal
  separators now works correctly. #11 (Vim 8.2.1738)
- `WinBar` menus (which are used by plugins like vimspector) now work
  properly and don't create dummy menu items. #918
- Using `:browse tabnew` no longer crashes MacVim in terminal mode.
  #1107 (Vim 8.2.1842)

Misc
====================

- Scripting languages versions:
    - Python is now built against 3.9, up from 3.8.
    - Lua is now built against 5.4, up from 5.3.

Compatibility
====================

Requires macOS 10.9 or above.

Script interfaces have compatibility with these versions:

- Lua 5.4
- Perl 5.18
- Python2 2.7
- Python3 3.9
- Ruby 2.7

ychin added a commit that referenced this pull request

Dec 12, 2020
Updated to Vim 8.2.2127.

*Note*: This release doesn't natively support Apple Silicon / M1 yet, but
does work under Rosetta. See below.

Features
====================

Big Sur / macOS 11
--------------------

- MacVim now has an updated app icon (#1054), and preference pane / toolbars
  have been updated to match Big Sur's interface guidelines. (#1128)
- Fixed Touch Bar warnings when launching MacVim from the terminal.
  #1114
- SF Symbol characters will show up properly as double-width as most of
  these icons would take up more than one column. Note that these
  characters are specific to macOS and would not work in other
  platforms. #1129

Renderer / scrolling performance improvements
--------------------

The Core Text renderer has been rewritten and is now much faster!
Scrolling should not stutter and lag like before and generally it should
feel a lot smoother now. Thanks to Sidney San Martín (@s4y) for the
contribution. #858

With this change, the non-Core-Text renderer is now considered
deprecated. The old renderer is accessible either through the Preference
Pane (under Advanced) or by setting the defaults "MMRenderer" to 0. It
works for now, but it will be removed in a future update as it has known
bugs.

Menu Localization
--------------------

Menus are now localized, see `:h langmenu` for how Vim menu localization
works. You can use `set langmenu=none` to turn it off if you would like. #1099

There still exists a few menu items that are not localized, and the
general MacVim GUI is not localized as well. If you would like to help,
please use #1102 to coordinate with MacVim dev team.

Getting help / Help menu
--------------------

- Help menu's search bar now searches Vim documentation as well! See
  #1095.
- Vimtutor is now bundled with MacVim, and you can access vimtutor from
  the Help menu (#1096). There is also a link to the latest release
  notes as well (#1131).

General
====================

- This release does not contain a native universal app for Apple Silicon
  / M1 Macs yet. The release binary will still work under Rosetta, which
  should provide enough performance, but if you use Python/etc plugins,
  you need to make sure you have x86 versions of Python/etc installed
  (which is still the default for Homebrew as of this release).

  MacVim is buildable under Apple Silicon, so if you need a native
  binary, you could build it yourself by downloading the source from the
  Github repository. See #1136 for progress on releasing a universal app
  for Apple Silicon.

- MacVim has enabled the Github Discussions feature, which serves as a
  good spot for general discussions and questions. See
  #1130 and check it
  out!

Fixes
====================

- Launching MacVim from the Dock with locales that use "," for decimal
  separators now works correctly. #11 (Vim 8.2.1738)
- `WinBar` menus (which are used by plugins like vimspector) now work
  properly and don't create dummy menu items. #918
- Using `:browse tabnew` no longer crashes MacVim in terminal mode.
  #1107 (Vim 8.2.1842)

Misc
====================

- Scripting languages versions:
    - Python is now built against 3.9, up from 3.8.
    - Lua is now built against 5.4, up from 5.3.

Compatibility
====================

Requires macOS 10.9 or above.

Script interfaces have compatibility with these versions:

- Lua 5.4
- Perl 5.18
- Python2 2.7
- Python3 3.9
- Ruby 2.7

@s4y s4y deleted the stateful-render branch

December 12, 2020 16:24

This was referenced

Dec 24, 2020

ychin added a commit to ychin/macvim that referenced this pull request

Dec 26, 2020
Recent change to stateful renderer (macvim-dev#858) has inadvertantly changed how
MacVim handles line spacing. Previously, MacVim intentionally ignores
the line spacing of a font and creates a new dummy font that essentially
has line spacing of 1, but the new code uses the font as is. This means
font with non-standard line spacing (e.g. Input Mono) will look
different. This is technically the correct way to handle fonts but is
different from how MacVim has worked for years.

Also, see last time this regression (where MacVim didn't discard line
spacing) happened in macvim-dev#928 / macvim-dev#949 which was fixed in macvim-dev#957. Also see macvim-dev#977
where the bug was filed the other way requesting for using the font's
line spacing instead of discarding it.

This commit re-introduces the behavior to discard line spacing, but only
provides it as an option (can be set in the preference pane), while
defaulting to using the line spacing as that seems more correct.

Note that from a casual survey of other terminals and editors, this
behavior is quite inconsistent. Xcode does use the font's line spacing,
and was partially the motivation of switching to that as a default.

Close macvim-dev#1152.

@ychin ychin mentioned this pull request

Dec 26, 2020

This was referenced

Aug 4, 2022