summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2019-10-01 22:16:48 +0200
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2019-10-01 22:18:12 +0200
commitcb1fa307e7ea8c55d210f23097143fa1f9f6160c (patch)
treed2701ddbd3b84a30c9a77c0be4be93405fc0d6f2 /ranger
parent11087fd48f4fcbec9112a25d77eec0a5b2211d9f (diff)
downloadranger-cb1fa307e7ea8c55d210f23097143fa1f9f6160c.tar.gz
Add a configurable VCS max message length
Previously it was hardcoded as 50, let's make it easy to change for
the user.

Improves upon #1705.
Related to #1704.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/gui/widgets/statusbar.py6
3 files changed, 9 insertions, 1 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 00a20def..b0bddd55 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -67,6 +67,9 @@ set vcs_backend_hg disabled
 set vcs_backend_bzr disabled
 set vcs_backend_svn disabled
 
+# Truncate the long commit messages to this length when shown in the statusbar.
+set vcs_msg_length 50
+
 # Use one of the supported image preview protocols
 set preview_images false
 
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 82901ac0..6fc2da5e 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -94,6 +94,7 @@ ALLOWED_SETTINGS = {
     'vcs_backend_git': str,
     'vcs_backend_hg': str,
     'vcs_backend_svn': str,
+    'vcs_msg_length': int,
     'viewmode': str,
     'w3m_delay': float,
     'w3m_offset': int,
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index 19113012..fd44613e 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -212,7 +212,11 @@ class StatusBar(Widget):  # pylint: disable=too-many-instance-attributes
                 left.add_space()
                 left.add(directory.vcs.rootvcs.head['date'].strftime(self.timeformat), 'vcsdate')
                 left.add_space()
-                left.add(directory.vcs.rootvcs.head['summary'][:50], 'vcscommit')
+                summary_length = self.settings.vcs_msg_length or 50
+                left.add(
+                    directory.vcs.rootvcs.head['summary'][:summary_length],
+                    'vcscommit'
+                )
 
     def _get_owner(self, target):
         uid = target.stat.st_uid