From 1c3e10f92648a74a4cba614a2841a0841052bb1d Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 25 Mar 2021 20:21:42 -0400 Subject: [PATCH] [visual] implement NCVISUAL_OPTION_HORALIGNED for cells 1443 --- src/lib/visual.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/visual.c b/src/lib/visual.c index 5f8d63ae7..d937cd05a 100644 --- a/src/lib/visual.c +++ b/src/lib/visual.c @@ -463,14 +463,16 @@ ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitse ncplane_dim_yx(n, &disprows, &dispcols); dispcols *= encoding_x_scale(&nc->tcache, bset); disprows *= encoding_y_scale(&nc->tcache, bset); + if(!(flags & NCVISUAL_OPTION_HORALIGNED)){ + dispcols -= placex; + } disprows -= placey; - dispcols -= placex; if(scaling == NCSCALE_SCALE || scaling == NCSCALE_SCALE_HIRES){ scale_visual(ncv, &disprows, &dispcols); } // else stretch } if(flags & NCVISUAL_OPTION_HORALIGNED){ - placex = (ncplane_dim_x(n) - dispcols) / 2; + placex = (ncplane_dim_x(n) - dispcols / encoding_x_scale(&nc->tcache, bset)) / 2; } } leny = (leny / (double)ncv->rows) * ((double)disprows);