[arch-commits] Commit in alacritty/trunk (PKGBUILD pr2367.patch)

Jiachen Yang farseerfc at archlinux.org
Fri May 10 04:26:43 UTC 2019


    Date: Friday, May 10, 2019 @ 04:26:43
  Author: farseerfc
Revision: 464755

upgpkg: alacritty 0.3.2-2

alacritty 0.3.2-2: apply PR2367 to fix cursor issue

Added:
  alacritty/trunk/pr2367.patch
Modified:
  alacritty/trunk/PKGBUILD

--------------+
 PKGBUILD     |    7 +++-
 pr2367.patch |   89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+), 1 deletion(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2019-05-10 04:21:15 UTC (rev 464754)
+++ PKGBUILD	2019-05-10 04:26:43 UTC (rev 464755)
@@ -7,19 +7,24 @@
 pkgdesc="A cross-platform, GPU-accelerated terminal emulator"
 _pkgver=0.3.2
 pkgver=$_pkgver
-pkgrel=1
+pkgrel=2
 arch=('x86_64')
 url="https://github.com/jwilm/alacritty"
 license=('Apache')
 makedepends=('rust' 'cargo' 'cmake' 'fontconfig' 'ncurses' 'desktop-file-utils' 'gdb')
 source=("${pkgbase}-${_pkgver}.tar.gz::https://github.com/jwilm/${pkgbase}/archive/v${_pkgver}.tar.gz"
+        "pr2367.patch"
         "fix-transparency-${_pkgver}.patch")
 sha256sums=('e2bc5323d505d9d487b2fdfc29f82a77e18b17f92de3988742950471808272f7'
+            '56d01cf49d68110af0218183e8867554d47953507ae1b570a576a83b452e367d'
             'c1d6de5d791b905c6b71f1898dac321db47fe145bbbbf06676823938e20ae399')
 
 prepare() {
   cd $pkgbase-$_pkgver
+  # https://github.com/jwilm/alacritty/issues/2254
   patch -Np1 -i ../fix-transparency-${_pkgver}.patch
+  # https://github.com/jwilm/alacritty/pull/2367
+  patch -Np1 -i ../pr2367.patch
 }
 build(){
   cd $pkgbase-$_pkgver

Added: pr2367.patch
===================================================================
--- pr2367.patch	                        (rev 0)
+++ pr2367.patch	2019-05-10 04:26:43 UTC (rev 464755)
@@ -0,0 +1,89 @@
+diff --git a/src/ansi.rs b/src/ansi.rs
+index 4e76c05b4..c0ebb79c8 100644
+--- a/src/ansi.rs
++++ b/src/ansi.rs
+@@ -343,7 +343,7 @@ pub trait Handler {
+ }
+ 
+ /// Describes shape of cursor
+-#[derive(Debug, Eq, PartialEq, Copy, Clone, Deserialize)]
++#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash, Deserialize)]
+ pub enum CursorStyle {
+     /// Cursor is a block like `▒`
+     Block,
+diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
+index fd10c8612..c0e3081d6 100644
+--- a/src/renderer/mod.rs
++++ b/src/renderer/mod.rs
+@@ -26,6 +26,7 @@ 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::gl;
+ use crate::gl::types::*;
+@@ -154,6 +155,9 @@ pub struct GlyphCache {
+     /// Cache of buffered glyphs
+     cache: HashMap<GlyphKey, Glyph, BuildHasherDefault<FnvHasher>>,
+ 
++    /// Cache of buffered cursor glyphs
++    cursor_cache: HashMap<CursorStyle, Glyph, BuildHasherDefault<FnvHasher>>,
++
+     /// Rasterizer for loading new glyphs
+     rasterizer: Rasterizer,
+ 
+@@ -195,6 +199,7 @@ impl GlyphCache {
+ 
+         let mut cache = GlyphCache {
+             cache: HashMap::default(),
++            cursor_cache: HashMap::default(),
+             rasterizer,
+             font_size: font.size(),
+             font_key: regular,
+@@ -302,6 +307,7 @@ impl GlyphCache {
+         // Clear currently cached data in both GL and the registry
+         loader.clear();
+         self.cache = HashMap::default();
++        self.cursor_cache = HashMap::default();
+ 
+         // Update dpi scaling
+         self.rasterizer.update_dpr(dpr as f32);
+@@ -984,9 +990,12 @@ impl<'a> RenderApi<'a> {
+ 
+     pub fn render_cell(&mut self, cell: RenderableCell, glyph_cache: &mut GlyphCache) {
+         let chars = match cell.inner {
+-            RenderableCellContent::Raw(ref raw) => {
++            RenderableCellContent::Cursor((cursor_style, ref raw)) => {
+                 // Raw cell pixel buffers like cursors don't need to go through font lookup
+-                let glyph = self.load_glyph(raw);
++                let glyph = glyph_cache
++                    .cursor_cache
++                    .entry(cursor_style)
++                    .or_insert_with(|| self.load_glyph(raw));
+                 self.add_render_item(&cell, &glyph);
+                 return;
+             },
+diff --git a/src/term/mod.rs b/src/term/mod.rs
+index 0e95423d9..07b643fae 100644
+--- a/src/term/mod.rs
++++ b/src/term/mod.rs
+@@ -259,7 +259,7 @@ impl<'a> RenderableCellsIter<'a> {
+ #[derive(Clone, Debug)]
+ pub enum RenderableCellContent {
+     Chars([char; cell::MAX_ZEROWIDTH_CHARS + 1]),
+-    Raw(RasterizedGlyph),
++    Cursor((CursorStyle, RasterizedGlyph)),
+ }
+ 
+ #[derive(Clone, Debug)]
+@@ -385,7 +385,8 @@ impl<'a> Iterator for RenderableCellsIter<'a> {
+                     let mut renderable_cell =
+                         RenderableCell::new(self.config, self.colors, cell, false);
+ 
+-                    renderable_cell.inner = RenderableCellContent::Raw(cursor_cell);
++                    renderable_cell.inner =
++                        RenderableCellContent::Cursor((self.cursor_style, cursor_cell));
+ 
+                     if let Some(color) = self.config.cursor_cursor_color() {
+                         renderable_cell.fg = color;



More information about the arch-commits mailing list