Add option to center env name (#683)

This commit is contained in:
llc0930
2024-08-09 16:44:49 +00:00
committed by GitHub
parent c87d5b4e7a
commit b84158e1c0
6 changed files with 19 additions and 7 deletions

View File

@@ -133,7 +133,10 @@ fn drawItem(label: *EnvironmentLabel, environment: Environment, x: usize, y: usi
const length = @min(environment.name.len, label.visible_length - 3);
if (length == 0) return false;
const nx = if (label.text_in_center) (label.x + (label.visible_length - environment.name.len) / 2) else (label.x + 2);
label.first_char_x = nx + environment.name.len;
label.buffer.drawLabel(environment.specifier, x, y);
label.buffer.drawLabel(environment.name, label.x + 2, label.y);
label.buffer.drawLabel(environment.name, nx, label.y);
return true;
}