[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117518: Implement echo suppression in non-interacti
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] trunk r117518: Implement echo suppression in non-interactive mode for MS-Windows. |
Date: |
Fri, 11 Jul 2014 13:58:59 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117518
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17839
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2014-07-11 16:58:02 +0300
message:
Implement echo suppression in non-interactive mode for MS-Windows.
src/minibuf.c (read_minibuf_noninteractive): Finish reading on '\r',
not only on '\n'.
src/sysdep.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty)
[DOS_NT]: Implement for WINDOWSNT.
src/systty.h (struct emacs_tty) [DOS_NT]: The struct member is now
unsigned.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/minibuf.c minibuf.c-20091113204419-o5vbwnq5f7feedwu-242
src/sysdep.c sysdep.c-20091113204419-o5vbwnq5f7feedwu-448
src/systty.h systty.h-20091113204419-o5vbwnq5f7feedwu-463
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-07-11 12:35:23 +0000
+++ b/src/ChangeLog 2014-07-11 13:58:02 +0000
@@ -1,3 +1,14 @@
+2014-07-11 Eli Zaretskii <address@hidden>
+
+ * minibuf.c (read_minibuf_noninteractive): Finish reading on '\r',
+ not only on '\n'.
+
+ * sysdep.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty)
+ [DOS_NT]: Implement for WINDOWSNT.
+
+ * systty.h (struct emacs_tty) [DOS_NT]: The struct member is now
+ unsigned.
+
2014-07-11 Michael Albinus <address@hidden>
* sysdep.c (suppress_echo_on_tty): New function.
=== modified file 'src/minibuf.c'
--- a/src/minibuf.c 2014-07-11 12:35:23 +0000
+++ b/src/minibuf.c 2014-07-11 13:58:02 +0000
@@ -251,7 +251,7 @@
len = 0;
line = xmalloc (size);
- while ((c = getchar ()) != '\n')
+ while ((c = getchar ()) != '\n' && c != '\r')
{
if (c == EOF)
{
@@ -280,7 +280,7 @@
emacs_set_tty (fileno (stdin), &etty, 0);
}
- if (len || c == '\n')
+ if (len || c == '\n' || c == '\r')
{
val = make_string (line, len);
xfree (line);
=== modified file 'src/sysdep.c'
--- a/src/sysdep.c 2014-07-11 12:35:23 +0000
+++ b/src/sysdep.c 2014-07-11 13:58:02 +0000
@@ -783,9 +783,20 @@
emacs_get_tty (int fd, struct emacs_tty *settings)
{
/* Retrieve the primary parameters - baud rate, character size, etcetera. */
-#ifndef DOS_NT
+ memset (&settings->main, 0, sizeof (settings->main));
+#ifdef DOS_NT
+#ifdef WINDOWSNT
+ HANDLE h = (HANDLE)_get_osfhandle (fd);
+ DWORD console_mode;
+
+ if (h && h != INVALID_HANDLE_VALUE)
+ {
+ if (GetConsoleMode (h, &console_mode))
+ settings->main = console_mode;
+ }
+#endif /* WINDOWSNT */
+#else /* !DOS_NT */
/* We have those nifty POSIX tcmumbleattr functions. */
- memset (&settings->main, 0, sizeof (settings->main));
tcgetattr (fd, &settings->main);
#endif
}
@@ -799,7 +810,22 @@
emacs_set_tty (int fd, struct emacs_tty *settings, bool flushp)
{
/* Set the primary parameters - baud rate, character size, etcetera. */
-#ifndef DOS_NT
+#ifdef DOS_NT
+#ifdef WINDOWSNT
+ HANDLE h = (HANDLE)_get_osfhandle (fd);
+
+ if (h && h != INVALID_HANDLE_VALUE)
+ {
+ DWORD new_mode;
+
+ /* Assume the handle is open for input. */
+ if (flushp)
+ FlushConsoleInputBuffer (h);
+ new_mode = settings->main;
+ SetConsoleMode (h, new_mode);
+ }
+#endif /* WINDOWSNT */
+#else /* !DOS_NT */
int i;
/* We have those nifty POSIX tcmumbleattr functions.
William J. Smith <address@hidden> writes:
@@ -1149,7 +1175,10 @@
struct emacs_tty etty;
emacs_get_tty (fd, &etty);
-#ifndef WINDOWSNT
+#ifdef DOS_NT
+ /* Set raw input mode. */
+ etty.main = 0;
+#else
etty.main.c_lflag &= ~ICANON; /* Disable buffering */
etty.main.c_lflag &= ~ECHO; /* Disable echoing */
#endif /* ! WINDOWSNT */
=== modified file 'src/systty.h'
--- a/src/systty.h 2014-01-01 07:43:34 +0000
+++ b/src/systty.h 2014-07-11 13:58:02 +0000
@@ -74,7 +74,7 @@
#ifndef DOS_NT
struct termios main;
#else /* DOS_NT */
- int main;
+ unsigned main;
#endif /* DOS_NT */
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117518: Implement echo suppression in non-interactive mode for MS-Windows.,
Eli Zaretskii <=