diff options
author | Elaina Martineau <elainamartineau@gmail.com> | 2019-05-11 09:57:22 -0600 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-05-11 15:57:22 +0000 |
commit | ca9724a5efe38a2db47d1b44b9d9f75cb6b6d20e (patch) | |
tree | 6257a1b87f7cc572f9259246f7bb4d1e699c1da3 /alacritty_terminal/src/renderer/mod.rs | |
parent | bdae9f0f28909be42448d105c9ff1bb376b35b0a (diff) | |
download | alacritty-ca9724a5efe38a2db47d1b44b9d9f75cb6b6d20e.tar.gz alacritty-ca9724a5efe38a2db47d1b44b9d9f75cb6b6d20e.zip |
Fix cursor only showing up over left half of wide characters
Diffstat (limited to 'alacritty_terminal/src/renderer/mod.rs')
-rw-r--r-- | alacritty_terminal/src/renderer/mod.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/alacritty_terminal/src/renderer/mod.rs b/alacritty_terminal/src/renderer/mod.rs index 53445a1c..dfaa797e 100644 --- a/alacritty_terminal/src/renderer/mod.rs +++ b/alacritty_terminal/src/renderer/mod.rs @@ -26,8 +26,8 @@ use font::{self, FontDesc, FontKey, GlyphKey, Rasterize, RasterizedGlyph, Raster use glutin::dpi::PhysicalSize; use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher}; -use crate::ansi::CursorStyle; use crate::config::{self, Config, Delta}; +use crate::cursor::{get_cursor_glyph, CursorKey}; use crate::gl; use crate::gl::types::*; use crate::index::{Column, Line}; @@ -160,7 +160,7 @@ pub struct GlyphCache { cache: HashMap<GlyphKey, Glyph, BuildHasherDefault<FnvHasher>>, /// Cache of buffered cursor glyphs - cursor_cache: HashMap<CursorStyle, Glyph, BuildHasherDefault<FnvHasher>>, + cursor_cache: HashMap<CursorKey, Glyph, BuildHasherDefault<FnvHasher>>, /// Rasterizer for loading new glyphs rasterizer: Rasterizer, @@ -994,12 +994,21 @@ impl<'a> RenderApi<'a> { pub fn render_cell(&mut self, cell: RenderableCell, glyph_cache: &mut GlyphCache) { let chars = match cell.inner { - RenderableCellContent::Cursor((cursor_style, ref raw)) => { + RenderableCellContent::Cursor(cursor_key) => { // Raw cell pixel buffers like cursors don't need to go through font lookup - let glyph = glyph_cache - .cursor_cache - .entry(cursor_style) - .or_insert_with(|| self.load_glyph(raw)); + let metrics = glyph_cache.metrics; + let glyph = glyph_cache.cursor_cache.entry(cursor_key).or_insert_with(|| { + let offset_x = self.config.font.offset.x; + let offset_y = self.config.font.offset.y; + + self.load_glyph(&get_cursor_glyph( + cursor_key.style, + metrics, + offset_x, + offset_y, + cursor_key.is_wide, + )) + }); self.add_render_item(&cell, &glyph); return; }, |