From 475b42f0037959f12afa3cbb9a426f1bf181a19c Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Wed, 21 Oct 2020 13:41:20 +0800 Subject: [PATCH] [misc] hacking ranger to align column better for vcs status with non-mono nerdfont --- ranger/config/commands.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ranger/config/commands.py b/ranger/config/commands.py index d2a0200..66bdc34 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -2,6 +2,8 @@ import os from ranger.core.loader import CommandLoader from ranger.api.commands import Command from ranger.gui.widgets import Widget +from ranger.gui.widgets.browsercolumn import BrowserColumn + Widget.vcsstatus_symb = { 'conflict': ( @@ -24,6 +26,7 @@ Widget.vcsstatus_symb = { '! ', ['vcsunknown']), } + Widget.vcsremotestatus_symb = { 'diverged': ( ' Y', ['vcsdiverged']), @@ -39,6 +42,19 @@ Widget.vcsremotestatus_symb = { ' !', ['vcsunknown']), } + +def wrap_draw_vcsstring_display(origin): + def _draw_vcsstring_display(*args, **kwargs): + vcsstring = origin(*args, **kwargs) + if vcsstring and vcsstring[0] and vcsstring[0][0] == ' ': + vcsstring[0][0] = ' ' + return vcsstring + return _draw_vcsstring_display + + +BrowserColumn._draw_vcsstring_display = wrap_draw_vcsstring_display(BrowserColumn._draw_vcsstring_display) + + class extracthere(Command): def execute(self): """ Extract copied files to current directory """