Open damanis opened 2 years ago
@damanis Linespace has no effect in settings.toml in geneovim. This was a design failure of the goneovim settings: the Neovim side has a linespace setting, and this value overrides the goneovim side's linespace. Therefore, it is necessary to set linespace by "set linespace=x" in init.lua, etc. Also, negative values for linespace have no effect in the current implementation. Do you want to set a negative value to make the line spacing tighter?
@akiyosi
Do you want to set a negative value to make the line spacing tighter?
Yes, I prefer compact lines, but now for same lines number on the screen the bigger goneovim window is needed.
Also, negative values for linespace have no effect in the current implementation
Do you mean in current goneovim implementation? In nvui, for example, it works.
The height of each row is calculated from font metrics; smaller values may cause rendering problems.
I recognize the NVUI example, but I do not believe it can be easily accepted by the gooneovim. In fact the description of ":h linespace" is as follows:
'linespace' 'lsp' number (default 0)
global
{only in the GUI}
Number of pixel lines inserted between characters. Useful if the font
uses the full character cell height, making lines touch each other.
When non-zero there is room for underlining.
With some fonts there can be too much room between lines (to have
space for ascents and descents). Then it makes sense to set
'linespace' to a negative value. This may cause display problems
though!
If you want to draw more lines, there is another way, for example by setting guifont
as follows:
set guifont=fontfamilyname:h9:w5
This is a method of specifying the ratio of the height and width of the font metrics; by specifying a value smaller than the normal height, each glyph will appear stretched or shrunk.
Font size is not same as linespace. May be Go ported QT does not support negative linespace, but original does (used by neovim-qt).
@damanis The negative value limitation is done by goneovim and is not a limitation of Qt Go binding. The following commit removes this restriction. Negative values can be set in this artifact. However, please note that as mentioned above, it is expected that some rendering will be incorrect.
@akiyosi In general, it works. But there are some rendering problem when cursor is moved (with linespace=-1).
This is normal state. After press twice 'k' (move cursor two lines up) the line '#If not ...' rendered incorrectly.
@akiyosi Seems, goneovim adds extra space between lines. I used compact fonts, so text should be compacted ever with linespace=0. There are two examples, both use same font and linespace=0 Goneovim
FVim
@damanis Hmmm, there should be no extra space inserted, especially if linespace is 0. If linespace is 0, goneovim will use the font metrics calculated in the Qt layer as is for cell height and width.
@akiyosi Yes, I saw the code. It gets from qt gui float64 metrics, not integer. Maybe math.ceil rounds up?
@akiyosi I checked nvim-qt code - it uses QFontMetrics, not QFontMetricsF.
@damanis Thanks for the info! So, are you saying that the extra space does not occur in neovim-qt?
@akiyosi Yes, it doesn't. nvim-qt
@damanis I have created an implementation based on metrics by QFontMetrics. Could you please confirm that it works?
@akiyosi Seems, it did not help.
@damanis Thank you. I can't see in the screenshot if there is any extra space, does the above screenshot have extra space?
@akiyosi It same as goneovim screenshot above.
@akiyosi May be, the ShellWidget::setCellSize() from neovim-qt shellwidget.cpp might give some idea. Related QT doc: https://doc.qt.io/qt-5/qwidget.html#sizeIncrement-prop
@damanis Thanks for the info.
By the way, if you disable the cache mode in settings.toml, does the rendering change a bit?
[Editor]
# ...
CachedDrawing = false
@akiyosi I don't see any difference.
@akiyosi It fixed in c7d444f WindowGeometryBasedOnFontmetrics don't use linespace for calculation, but it easy solve by configuration.
But still interesting where extra line appear from (with linespace=0).
Both 'Linespace=-1' in .config/goneovim/settings.toml and ':set linespace=-1' from Goneovim. Positive value, seems, works properly.