ui: remove any combinations of CR|LF from prompt response
authorYuya Nishihara <yuya@tcha.org>
Sat, 10 Mar 2018 15:50:09 +0900
changeset 36834 1527f40de3b3
parent 36833 46f4d71ed505
child 36835 5bc7ff103081
ui: remove any combinations of CR|LF from prompt response On Windows, we have to accept both CR+LF and LF. This patch simply makes any trailing CRs and LFs removed from a user input instead of doing stricter parsing, as an input must be a readable text.
mercurial/ui.py
--- a/mercurial/ui.py	Sat Mar 10 12:45:10 2018 -0500
+++ b/mercurial/ui.py	Sat Mar 10 15:50:09 2018 +0900
@@ -1296,8 +1296,7 @@
                 line = self.fin.readline()
                 if not line:
                     raise EOFError
-                if line.endswith(pycompat.oslinesep):
-                    line = line[:-len(pycompat.oslinesep)]
+                line = line.rstrip(pycompat.oslinesep)
 
         return line