From: Michael D. Lowis Date: Mon, 5 Jun 2017 16:00:58 +0000 (-0400) Subject: edit region columns should shrink when gutter is enabled X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=bce301363fbe0d76b0586e14209eef1ce421fd59;p=projs%2Ftide.git edit region columns should shrink when gutter is enabled --- diff --git a/lib/win.c b/lib/win.c index d3d9274..557a01c 100644 --- a/lib/win.c +++ b/lib/win.c @@ -143,14 +143,14 @@ void win_setscroll(double offset, double visible) { } static size_t gutter_cols(void) { - size_t len = 1, lines = win_buf(EDIT)->nlines; + size_t len = (LineNumbers ? 1 : 0), + lines = win_buf(EDIT)->nlines; while (LineNumbers && lines > 9) lines /= 10, len++; return len; } static size_t gutter_size(void) { - if (!LineNumbers) return 0; return (gutter_cols() * x11_font_width(Font)) + (LineNumbers ? 5 : 0); } @@ -193,7 +193,7 @@ static void layout(int width, int height) { Regions[EDIT].y = 5 + Regions[TAGS].y + Regions[TAGS].height; Regions[EDIT].height = (height - Regions[EDIT].y - 5); Regions[EDIT].width = width - Regions[SCROLL].width - 5; - view_resize(editview, Regions[EDIT].height / fheight, Regions[EDIT].width / fwidth); + view_resize(editview, Regions[EDIT].height / fheight, Regions[EDIT].width / fwidth - gutter_cols()); } static void onredraw(int width, int height) {