summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2024-08-07 19:22:25 -0400
committerIonen Wolkens <ionen@gentoo.org>2024-08-07 19:25:20 -0400
commit9bf46138dbd6577a4346da1cef967bec911fe385 (patch)
tree9dd805de48f8f10476a213b379915a239425ceaa /app-misc
parentgames-arcade/apricots: Drop old 0.2.7 (diff)
downloadgentoo-9bf46138dbd6577a4346da1cef967bec911fe385.tar.gz
gentoo-9bf46138dbd6577a4346da1cef967bec911fe385.tar.bz2
gentoo-9bf46138dbd6577a4346da1cef967bec911fe385.zip
app-misc/ranger: backport color-related crash fix
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'app-misc')
-rw-r--r--app-misc/ranger/files/ranger-1.9.3-color-crash-fix.patch25
-rw-r--r--app-misc/ranger/ranger-1.9.3-r2.ebuild (renamed from app-misc/ranger/ranger-1.9.3-r1.ebuild)4
2 files changed, 29 insertions, 0 deletions
diff --git a/app-misc/ranger/files/ranger-1.9.3-color-crash-fix.patch b/app-misc/ranger/files/ranger-1.9.3-color-crash-fix.patch
new file mode 100644
index 000000000000..4d28c529eca2
--- /dev/null
+++ b/app-misc/ranger/files/ranger-1.9.3-color-crash-fix.patch
@@ -0,0 +1,25 @@
+Backport of crash fix when previewing some files with colors.
+https://forums.gentoo.org/viewtopic-t-1170286.html
+https://github.com/ranger/ranger/commit/82eef55b1664
+https://github.com/ranger/ranger/commit/642d594b8328 (also needed)
+--- a/ranger/gui/color.py
++++ b/ranger/gui/color.py
+@@ -20,5 +20,6 @@
+ DEFAULT_FOREGROUND = curses.COLOR_WHITE
+ DEFAULT_BACKGROUND = curses.COLOR_BLACK
+-COLOR_PAIRS = {10: 0}
++# Color pair 0 is wired to white on black and cannot be changed
++COLOR_PAIRS = {(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND): 0}
+
+
+@@ -31,4 +32,10 @@
+ try:
+ curses.init_pair(size, fg, bg)
++ except ValueError:
++ # We're trying to add more pairs than the terminal can store,
++ # approximating to the closest color pair that's already stored
++ # would be cool but the easier solution is to just fall back to the
++ # default fore and background colors, pair 0
++ COLOR_PAIRS[key] = 0
+ except curses.error:
+ # If curses.use_default_colors() failed during the initialization
diff --git a/app-misc/ranger/ranger-1.9.3-r1.ebuild b/app-misc/ranger/ranger-1.9.3-r2.ebuild
index 161d96848cd0..28989e2d080d 100644
--- a/app-misc/ranger/ranger-1.9.3-r1.ebuild
+++ b/app-misc/ranger/ranger-1.9.3-r2.ebuild
@@ -25,6 +25,10 @@ SLOT="0"
distutils_enable_tests pytest
+PATCHES=(
+ "${FILESDIR}"/${P}-color-crash-fix.patch
+)
+
src_prepare() {
distutils-r1_src_prepare