[Github-comments] [geany/geany] Set the min-width of the line numbers? (#1694)

B4PzwL3YVGa6 notifications at xxxxx
Sun Feb 24 18:14:15 UTC 2019


> No, its only automatic.
> 
> The margin width is automatic based on the number of lines in the file so space isn't wasted for small files and it still allows stupidly huge log files to be opened.

lie



> Is there a way to set the min-width of the line numbers column?
> Just because line 1 to 9 doesn't have the same width of line 100 to 999.

yes we can
compare function below with source
src/sciwrappers.c:99

```C
void sci_set_line_numbers(ScintillaObject *sci, gboolean set)
{
  if (set)
  {
    gchar tmp_str[15];
    gint len = (gint) SSM(sci, SCI_GETLINECOUNT, 0, 0);
    gint width;

    g_snprintf(tmp_str, 15, "_%d", len + 4);
    width =  sci_text_width(sci, STYLE_LINENUMBER, "_99999");
    SSM(sci, SCI_SETMARGINWIDTHN, 0, width);
    SSM(sci, SCI_SETMARGINSENSITIVEN, 0, FALSE); /* use default behaviour */
  }
  else
  {
    SSM(sci, SCI_SETMARGINWIDTHN, 0, 0);
  }
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1694#issuecomment-466801353
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190224/2c5e21a7/attachment-0001.html>


More information about the Github-comments mailing list