Skip to content

Enabling vterm-mode should happen after the buffer is displayed #26

@aaronjensen

Description

@aaronjensen

The way that multi-vterm-project works is that it creates a hidden buffer, enables vterm-mode and then displays it. There appears to be a race condition wherein vterm will set a terminal width to something that is wider than the window it is about to be displayed in. It has no way to know where it is about to be displayed. When the buffer is eventually displayed in a window, it is resized and it looks wrong. To make matters worse, vterm won't detect the size again immediately, it requires some other window or frame event to get it to recalculate.

Bad

CleanShot 2022-12-27 at 13 51 11@2x

Good

CleanShot 2022-12-27 at 13 51 39@2x

This is likely why vterm itself forces you to provide the pop to/display buffer function in the internal function that causes the buffer to have vterm-mode enabled:

https://github.com/akermu/emacs-libvterm/blob/f14d113ee4618f052879509ec378feb9766b871b/vterm.el#L1327-L1342

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions