Properly fixed the issues with the grid :D
This commit is contained in:
parent
61e8c321bc
commit
bc728c160d
1 changed files with 7 additions and 14 deletions
|
@ -24,10 +24,9 @@ use theme::TerminalStyle;
|
||||||
use crate::{Input, ScrollTerminal, Terminal};
|
use crate::{Input, ScrollTerminal, Terminal};
|
||||||
|
|
||||||
const ALACRITTY_SCROLL_MULTIPLIER: f32 = 3.;
|
const ALACRITTY_SCROLL_MULTIPLIER: f32 = 3.;
|
||||||
const MAGIC_VISUAL_WIDTH_MULTIPLIER: f32 = 1.28; //1/8th + .003 so we bias long instead of short
|
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
const DEBUG_GRID: bool = false;
|
const DEBUG_GRID: bool = true;
|
||||||
|
|
||||||
pub struct TerminalEl {
|
pub struct TerminalEl {
|
||||||
view: WeakViewHandle<Terminal>,
|
view: WeakViewHandle<Terminal>,
|
||||||
|
@ -60,17 +59,14 @@ impl Element for TerminalEl {
|
||||||
let size = constraint.max;
|
let size = constraint.max;
|
||||||
let settings = cx.global::<Settings>();
|
let settings = cx.global::<Settings>();
|
||||||
let editor_theme = &settings.theme.editor;
|
let editor_theme = &settings.theme.editor;
|
||||||
|
let font_cache = cx.font_cache();
|
||||||
|
|
||||||
//Set up text rendering
|
//Set up text rendering
|
||||||
let text_style = TextStyle {
|
let text_style = TextStyle {
|
||||||
color: editor_theme.text_color,
|
color: editor_theme.text_color,
|
||||||
font_family_id: settings.buffer_font_family,
|
font_family_id: settings.buffer_font_family,
|
||||||
font_family_name: cx
|
font_family_name: font_cache.family_name(settings.buffer_font_family).unwrap(),
|
||||||
.font_cache()
|
font_id: font_cache
|
||||||
.family_name(settings.buffer_font_family)
|
|
||||||
.unwrap(),
|
|
||||||
font_id: cx
|
|
||||||
.font_cache()
|
|
||||||
.select_font(settings.buffer_font_family, &Default::default())
|
.select_font(settings.buffer_font_family, &Default::default())
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
font_size: settings.buffer_font_size,
|
font_size: settings.buffer_font_size,
|
||||||
|
@ -78,14 +74,11 @@ impl Element for TerminalEl {
|
||||||
underline: Default::default(),
|
underline: Default::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let line_height = cx.font_cache.line_height(text_style.font_size);
|
let line_height = font_cache.line_height(text_style.font_size);
|
||||||
let cell_width = cx
|
let cell_width = font_cache.em_advance(text_style.font_id, text_style.font_size);
|
||||||
.font_cache()
|
|
||||||
.em_width(text_style.font_id, text_style.font_size)
|
|
||||||
* MAGIC_VISUAL_WIDTH_MULTIPLIER;
|
|
||||||
|
|
||||||
let new_size = SizeInfo::new(
|
let new_size = SizeInfo::new(
|
||||||
size.x() - cell_width, //Padding. Really should make this more explicit
|
size.x() - cell_width,
|
||||||
size.y(),
|
size.y(),
|
||||||
cell_width,
|
cell_width,
|
||||||
line_height,
|
line_height,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue