Use line height from attrs

This commit is contained in:
Jeremy Soller 2024-06-06 15:21:44 -06:00
parent 8638ec29bb
commit 37688747e1
6 changed files with 44 additions and 60 deletions

View file

@ -57,11 +57,11 @@ impl<'buffer> Editor<'buffer> {
F: FnMut(i32, i32, u32, u32, Color),
{
self.with_buffer(|buffer| {
let line_height = buffer.metrics().line_height;
for run in buffer.layout_runs() {
let line_i = run.line_i;
let line_y = run.line_y;
let line_top = run.line_top;
let line_height = run.line_height;
let cursor_glyph_opt = |cursor: &Cursor| -> Option<(usize, f32)> {
if cursor.line == line_i {

View file

@ -312,11 +312,11 @@ impl<'syntax_system, 'buffer> ViEditor<'syntax_system, 'buffer> {
let size = buffer.size();
f(0, 0, size.0 as u32, size.1 as u32, background_color);
let font_size = buffer.metrics().font_size;
let line_height = buffer.metrics().line_height;
for run in buffer.layout_runs() {
let line_i = run.line_i;
let line_y = run.line_y;
let line_top = run.line_top;
let line_height = run.line_height;
let cursor_glyph_opt = |cursor: &Cursor| -> Option<(usize, f32, f32)> {
//TODO: better calculation of width