Skip to content

AdjustLineNumberMarginOnZoom

mitchell edited this page Sep 18, 2020 · 2 revisions

Add the following lines to ~/.textadept/init.lua to adjust the line number margin on zoom:

-- adjust line number margin on zoom
events.connect('SCN', function(n)
  if n.code == _SCINTILLA.constants.SCN_ZOOM then
    local buffer = buffer
    local width = #(buffer.line_count..'')
    width = width > 4 and width or 4
    buffer.margin_width_n[0] = 4 + width * buffer:text_width(_SCINTILLA.constants.STYLE_LINENUMBER, '9')
  end
end)
Clone this wiki locally