[misc] hacking ranger to align column better for vcs status with non-mono nerdfont

This commit is contained in:
Klesh Wong 2020-10-21 13:41:20 +08:00
parent 470ae2c7cd
commit 475b42f003

View File

@ -2,6 +2,8 @@ import os
from ranger.core.loader import CommandLoader from ranger.core.loader import CommandLoader
from ranger.api.commands import Command from ranger.api.commands import Command
from ranger.gui.widgets import Widget from ranger.gui.widgets import Widget
from ranger.gui.widgets.browsercolumn import BrowserColumn
Widget.vcsstatus_symb = { Widget.vcsstatus_symb = {
'conflict': ( 'conflict': (
@ -24,6 +26,7 @@ Widget.vcsstatus_symb = {
'! ', ['vcsunknown']), '! ', ['vcsunknown']),
} }
Widget.vcsremotestatus_symb = { Widget.vcsremotestatus_symb = {
'diverged': ( 'diverged': (
' Y', ['vcsdiverged']), ' Y', ['vcsdiverged']),
@ -39,6 +42,19 @@ Widget.vcsremotestatus_symb = {
' !', ['vcsunknown']), ' !', ['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): class extracthere(Command):
def execute(self): def execute(self):
""" Extract copied files to current directory """ """ Extract copied files to current directory """