diff options
| author | Eli Zaretskii | 2014-07-11 18:44:25 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-07-11 18:44:25 +0300 |
| commit | d79194419ba59abef54a9a56a06271e230902271 (patch) | |
| tree | 21ce8ef882444897e0679fd5d1764d225b2f39b6 /src | |
| parent | e8963bd757bce1a58d5c5b081f53a873857d25df (diff) | |
| download | emacs-d79194419ba59abef54a9a56a06271e230902271.tar.gz emacs-d79194419ba59abef54a9a56a06271e230902271.zip | |
Fix reading input without echoing on MS-Windows.
src/minibuf.c (read_minibuf_noninteractive) [WINDOWSNT]: Switch stdin
to binary mode when not echoing input.
Fixes: debbugs:17839
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 1 | ||||
| -rw-r--r-- | src/minibuf.c | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a016f3cadc2..282b79eef12 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | * minibuf.c (read_minibuf_noninteractive): Finish reading on '\r', | 3 | * minibuf.c (read_minibuf_noninteractive): Finish reading on '\r', |
| 4 | not only on '\n'. | 4 | not only on '\n'. |
| 5 | [WINDOWSNT]: Switch stdin to binary mode when not echoing input. | ||
| 5 | 6 | ||
| 6 | * sysdep.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty) | 7 | * sysdep.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty) |
| 7 | [DOS_NT]: Implement for WINDOWSNT. | 8 | [DOS_NT]: Implement for WINDOWSNT. |
diff --git a/src/minibuf.c b/src/minibuf.c index c77f5955d86..5b6c9154621 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -22,6 +22,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | #include <errno.h> | 22 | #include <errno.h> |
| 23 | #include <stdio.h> | 23 | #include <stdio.h> |
| 24 | 24 | ||
| 25 | #ifdef WINDOWSNT | ||
| 26 | #include <fcntl.h> /* For O_BINARY, O_TEXT. */ | ||
| 27 | #endif | ||
| 28 | |||
| 25 | #include "lisp.h" | 29 | #include "lisp.h" |
| 26 | #include "commands.h" | 30 | #include "commands.h" |
| 27 | #include "character.h" | 31 | #include "character.h" |
| @@ -240,6 +244,9 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 240 | if (hide_char) | 244 | if (hide_char) |
| 241 | { | 245 | { |
| 242 | emacs_get_tty (fileno (stdin), &etty); | 246 | emacs_get_tty (fileno (stdin), &etty); |
| 247 | #ifdef WINDOWSNT | ||
| 248 | _setmode (fileno (stdin), O_BINARY); | ||
| 249 | #endif | ||
| 243 | suppress_echo_on_tty (fileno (stdin)); | 250 | suppress_echo_on_tty (fileno (stdin)); |
| 244 | } | 251 | } |
| 245 | 252 | ||
| @@ -278,6 +285,9 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 278 | { | 285 | { |
| 279 | fprintf (stdout, "\n"); | 286 | fprintf (stdout, "\n"); |
| 280 | emacs_set_tty (fileno (stdin), &etty, 0); | 287 | emacs_set_tty (fileno (stdin), &etty, 0); |
| 288 | #ifdef WINDOWSNT | ||
| 289 | _setmode (fileno (stdin), O_TEXT); | ||
| 290 | #endif | ||
| 281 | } | 291 | } |
| 282 | 292 | ||
| 283 | if (len || c == '\n' || c == '\r') | 293 | if (len || c == '\n' || c == '\r') |