diff mercurial/filemerge.py @ 42565:4764e8436b2a

filemerge: make last line of prompts <40 english chars (issue6158) I've chosen <40 as the target so that other languages that may have a 2x blowup in character count can still have a chance to fit into an 80 column screen. Previously, we would show a prompt like: ``` keep (l)ocal [dest], take (o)ther [source], or leave (u)nresolved for some/potentially/really/long/path? ``` On at least some systems, if readline was in use then the last line of the prompt would be wrapped strangely if it couldn't fit entirely on one line. This strange wrapping may be just a carriage return without a line feed, overwriting the beginning of the line; example (100 columns wide, 65 character filename, and yes there's 10 spaces on the end, I assume this is to handle the user inputting longest word we provide as an option, "unresolved"): ``` ng/dir/name/that/does/not/work/well/with/readline/file.txt? ave (u)nresolved for some/lon ``` In some cases it may partially wrap onto the next line, but still be missing earlier parts in the line, such as below (60 columns wide, 65 character filename): ``` rev], or leave (u)nresolved for some/long/dir/name/that/do s/not/work/well/with/readline/file.txt? ``` With this fix, this looks like this on a 60 column screen: ``` tool vim_with_markers (for pattern some/long/dir/name/that/d oes/not/work/well/with/readline/file.txt) can't handle binar y tool meld can't handle binary tool vim_with_markers can't handle binary tool internal:merge3 can't handle binary tool merge can't handle binary no tool found to merge some/long/dir/name/that/does/not/work /well/with/readline/file.txt file 'some/long/dir/name/that/does/not/work/well/with/readli ne/file.txt' needs to be resolved. You can keep (l)ocal [working copy], take (o)ther [merge rev ], or leave (u)nresolved. What do you want to do? ``` Differential Revision: https://phab.mercurial-scm.org/D6562
author Kyle Lippincott <spectral@google.com>
date Thu, 20 Jun 2019 11:40:47 -0700
parents a8ccd821b7d2
children 2372284d9457
line wrap: on
line diff
--- a/mercurial/filemerge.py	Sat Jul 06 19:55:29 2019 -0400
+++ b/mercurial/filemerge.py	Thu Jun 20 11:40:47 2019 -0700
@@ -60,17 +60,20 @@
 mergeonly = internaltool.mergeonly # just the full merge, no premerge
 fullmerge = internaltool.fullmerge # both premerge and merge
 
+# IMPORTANT: keep the last line of this prompt very short ("What do you want to
+# do?") because of issue6158, ideally to <40 English characters (to allow other
+# languages that may take more columns to still have a chance to fit in an
+# 80-column screen).
 _localchangedotherdeletedmsg = _(
     "file '%(fd)s' was deleted in other%(o)s but was modified in local%(l)s.\n"
-    "What do you want to do?\n"
-    "use (c)hanged version, (d)elete, or leave (u)nresolved?"
+    "You can use (c)hanged version, (d)elete, or leave (u)nresolved.\n"
+    "What do you want to do?"
     "$$ &Changed $$ &Delete $$ &Unresolved")
 
 _otherchangedlocaldeletedmsg = _(
     "file '%(fd)s' was deleted in local%(l)s but was modified in other%(o)s.\n"
-    "What do you want to do?\n"
-    "use (c)hanged version, leave (d)eleted, or "
-    "leave (u)nresolved?"
+    "You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.\n"
+    "What do you want to do?"
     "$$ &Changed $$ &Deleted $$ &Unresolved")
 
 class absentfilectx(object):
@@ -299,9 +302,14 @@
                 _otherchangedlocaldeletedmsg % prompts, 2)
             choice = ['other', 'local', 'unresolved'][index]
         else:
+            # IMPORTANT: keep the last line of this prompt ("What do you want to
+            # do?") very short, see comment next to _localchangedotherdeletedmsg
+            # at the top of the file for details.
             index = ui.promptchoice(
-                _("keep (l)ocal%(l)s, take (o)ther%(o)s, or leave (u)nresolved"
-                  " for %(fd)s?"
+                _("file '%(fd)s' needs to be resolved.\n"
+                  "You can keep (l)ocal%(l)s, take (o)ther%(o)s, or leave "
+                  "(u)nresolved.\n"
+                  "What do you want to do?"
                   "$$ &Local $$ &Other $$ &Unresolved") % prompts, 2)
             choice = ['local', 'other', 'unresolved'][index]