summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2019-10-02 18:26:33 +0200
committerGitHub <noreply@github.com>2019-10-02 18:26:33 +0200
commit1946fb003b9dd8b45f2cb2e639a42b1e067df677 (patch)
tree1c6acfea5300ea741cc5437d50532190ef9626dd
parent5e711b87f9d6261d36c37535b3777ff8a2ffc3eb (diff)
parent71be60293a5e6f082459db0f2fb932e7a7c24b14 (diff)
downloadranger-1946fb003b9dd8b45f2cb2e639a42b1e067df677.tar.gz
Merge pull request #1706 from Vifon/vcs-truncate
Add a configurable max VCS message length
-rw-r--r--doc/ranger.16
-rw-r--r--doc/ranger.pod5
-rw-r--r--examples/rc_emacs.conf3
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/gui/widgets/statusbar.py6
6 files changed, 22 insertions, 2 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index ee4c84e7..e67354af 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -133,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-.TH RANGER 1 "ranger-1.9.2" "2019-09-24" "ranger manual"
+.TH RANGER 1 "ranger-1.9.2" "2019-10-01" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -1124,6 +1124,10 @@ Sets the state for the version control backend. The possible values are:
 \& local      display only local state.
 \& enabled    display both, local and remote state. May be slow for hg and bzr.
 .Ve
+.IP "vcs_msg_length [int]" 4
+.IX Item "vcs_msg_length [int]"
+Length to truncate first line of the commit messages to when shown in
+the statusbar.  Defaults to 50.
 .IP "viewmode [string]" 4
 .IX Item "viewmode [string]"
 Sets the view mode, which can be \fBmiller\fR to display the files in the
diff --git a/doc/ranger.pod b/doc/ranger.pod
index beb2fdb8..999a1f57 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -1170,6 +1170,11 @@ Sets the state for the version control backend. The possible values are:
  local      display only local state.
  enabled    display both, local and remote state. May be slow for hg and bzr.
 
+=item vcs_msg_length [int]
+
+Length to truncate first line of the commit messages to when shown in
+the statusbar.  Defaults to 50.
+
 =item viewmode [string]
 
 Sets the view mode, which can be B<miller> to display the files in the
diff --git a/examples/rc_emacs.conf b/examples/rc_emacs.conf
index e3596ba5..a69d68fe 100644
--- a/examples/rc_emacs.conf
+++ b/examples/rc_emacs.conf
@@ -59,6 +59,9 @@ set vcs_backend_git enabled
 set vcs_backend_hg disabled
 set vcs_backend_bzr 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/config/rc.conf b/ranger/config/rc.conf
index 61ce77aa..e557d4de 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