Patchwork D6573: prompt: add develwarn about last line of prompt >45 chars (issue6158)

login
register
mail settings
Submitter phabricator
Date June 24, 2019, 11:28 p.m.
Message ID <differential-rev-PHID-DREV-osf5tbns4r7tdfzd6cmb-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/40671/
State Superseded
Headers show

Comments

phabricator - June 24, 2019, 11:28 p.m.
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6573

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-devel
phabricator - July 10, 2019, 7:23 p.m.
durin42 added a comment.


  Per your note that this will probably make other localizations sad, let's just give up on this for now?
  
  Sigh.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6573/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6573

To: spectral, #hg-reviewers
Cc: durin42, mercurial-devel

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1449,6 +1449,15 @@ 
             except Exception:
                 usereadline = False
 
+        prompt_lastline = prompt.split(pycompat.oslinesep)[-1]
+        # We're using 45 instead of 40 because of a prompt that - with the
+        # ` (yn)?` suffix, is 43 chars.
+        if len(prompt_lastline) > 45:
+            self.develwarn(
+                    'try to keep last line of prompt <40 chars, last line was: '
+                    '"%s" (%d chars)' % (prompt_lastline, len(prompt_lastline)),
+                    config='prompt-length')
+
         if self._colormode == 'win32' or not usereadline:
             if not promptopts:
                 promptopts = {}