Re: [PATCH/RFC 4/5] mingw: reuse tty-version of git_terminal_prompt
From: Jeff King <hidden>
Date: 2016-06-15 22:55:28
On Tue, Nov 13, 2012 at 03:04:06PM +0100, Erik Faye-Lund wrote:
The getpass-implementation we use on Windows isn't at all ideal; it works in raw-mode (as opposed to cooked mode), and as a result does not deal correcly with deletion, arrow-keys etc. Instead, use cooked mode to read a line at the time, allowing the C run-time to process the input properly. Since we set files to be opened in binary-mode by default on Windows, introduce a FORCE_TEXT macro that expands to the "t" modifier that forces the terminal to be opened in text-mode so we do not have to deal with CRLF issues.
I think this is OK. I had originally envisioned just having a separate "#ifdef WIN32" and not really sharing code at all with /dev/tty because I was worried that the conditionals would end up making it hard to read. This is a little more complex than I would have liked, but I do not see how the code sharing could be simplified any more than what you have done, and it is nice to avoid repeating ourselves. -Peff -- *** Please reply-to-all at all times *** *** (do not pretend to know who is subscribed and who is not) *** *** Please avoid top-posting. *** The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free. You received this message because you are subscribed to the Google Groups "msysGit" group. To post to this group, send email to msysgit@googlegroups.com To unsubscribe from this group, send email to msysgit+unsubscribe@googlegroups.com For more options, and view previous threads, visit this group at http://groups.google.com/group/msysgit?hl=en_US?hl=en