akermu / emacs-libvterm

Emacs libvterm integration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Characters with different height make some lines not to fit in the *vterm* window

rodrigomorales1 opened this issue · comments

TL; DR

I'm using vterm version 0.0.2 in GNU Emacs version 29.3 in Ubuntu 22.04.4 LTS.

I have noticed that Emacs shows some characters with different height which causes *vterm* not to be able to fit the entire terminal in the current Emacs window. That is, the first lines stop being shown. This is not convenient for tmux users that show the status bar at the top because it regularly disappears.

Description of the issue

  1. I started emacs using emacs -Q.
  2. I evaluated (require 'vterm)
  3. I launched vterm using M-x vterm.
  4. I opened tmux and moved the tmux status bar to the top. To do that, I pressed C-b : to open the tmux command line and evaluated set-option -g status-position top.

image

  1. I printed the contents of the file /tmp/a.txt (the code block below shows its content) using cat /tmp/a.txt and I noticed that the tmux status bar which was being shown at the top disappeared.
1⟳
2⟳
3⟳
4⟳
5⟳
6⟳
7⟳

image

  1. When I pressed C-l to clean the content of the terminal, I could see the tmux status bar again at the top.

image

Additional information

I tried printing the contents of the file /tmp/a.txt inside tmux in the terminal emulators gnome-terminal and kitty with the default font in Ubuntu 22.04.4 LTS and they were able to display the contents of the file /tmp/a.txt and the tmux status bar (see two screenshots below)

The image below shows the behavior in gnome-terminal

image

The image below shows the behavior in kitty

image

Personal thoughts

I suspect the tmux top bar disappears because the height of the character is greater than the other characters, but vterm thinks that all characters have the same height. Ideally, *vterm* should display the tmux top bar regardless of the characters that are shown in the terminal just as gnome-terminal and kitty are able to do it.

I believe there are two ways of solving this problem:

  1. Find a way to make Emacs display characters with the same height even when the characters are defined in different font files.
  2. Find a way to make vterm compute the height of the current window taking into consideration that some lines might have a greater height than others.

Related links

  • A question in Stack Overflow asked on Mar 28, 2013 where a user reports that some Greek characters affect line spacing in Emacs. The accepted answer recommends finding a font that contains all the characters needed.
  • A question in Stack Overflow asked on Nov 15, 2013 where a user asks why some line heights vary. The accepted answer states that removing some of the characters in the line solves the problem.
  • A question in Stack Overflow asked on Nov 8, 2012 where a user asks how to restrict the font height in Emacs.