Commit Graph

485 Commits

Author SHA1 Message Date
Ryan Prichard
80cc3b9096 Add a test case that writes and reads half-width vs full-width characters. 2015-10-05 01:01:24 -05:00
Ryan Prichard
db12b07706 Add winpty-debugserver.exe and document debugging environment variables. 2015-10-01 03:17:38 -05:00
Ryan Prichard
11ac33ef88 Fix a formatting problem in the README 2015-09-30 04:18:22 -05:00
Ryan Prichard
76bc37f307 Add make to the MSYS2 and Cygwin package lists. 2015-09-30 04:00:32 -05:00
Ryan Prichard
2ecc596f8b Update winpty to work with MSYS, MSYS2, and Cygwin.
* MSYS is 32-bit only.

 * MSYS2 and Cygwin are either 32-bit or 64-bit.  On 64-bit MSYS2/Cygwin,
   we use the same architecture for all generated binaries.

 * Prefer mingw-w64 to mingw.  mingw-w64 seems to be more up-to-date.
   It is the only option for 64-bit Windows, so stop looking for
   x86_64-pc-mingw32-g++.

 * Also pass -static when linking binaries.  Otherwise, a pthreads DLL
   is linked dynamically.
2015-09-30 03:34:16 -05:00
Ryan Prichard
9da12b25c5 Handle Shift-Tab.
* Fixes https://github.com/rprichard/winpty/issues/19
2015-09-29 05:41:44 -05:00
Ryan Prichard
a0dea2ed4d Comment out ConsoleInput trace lines. 2015-09-29 05:05:19 -05:00
Ryan Prichard
1082c3ded2 Factor out line content tracking into a ConsoleLine class.
* Make line content tracking a little more aggressive about outputting
   lines that were previously truncated.
2015-09-29 04:53:43 -05:00
Ryan Prichard
e19c29bd03 Avoid setting lpDesktop if there we didn't actually create a new desktop.
* Add debug information.

 * This change fixed a bug where the new winpty-agent.exe process
   successfully started, but immediately exited without reaching main().
   The bug occurred while SSH'ing into the Cygwin SSH server.
2015-09-29 02:32:57 -05:00
Ryan Prichard
d4640890cf Rewrite resize logic, introduce "direct mode", and tweak scroll scraping.
* Unfreeze the console while changing the buffer size.  Changing the
   buffer size hangs conhost.exe.  See:
    - https://github.com/rprichard/winpty/issues/31
    - https://wpdev.uservoice.com/forums/266908-command-prompt/suggestions/9941292-conhost-exe-hangs-in-win10-if-setconsolescreenbuff

 * Detect buffer size changes and switch to a "direct mode".  Direct mode
   makes no attempt to track incremental console changes.  Instead, the
   content of the current console window is printed.  This mode is
   intended for full-screen apps that resize the console.

 * Reopen CONOUT$, which detects apps that change the active screen buffer.
   Fixes https://github.com/rprichard/winpty/issues/34.

 * In the scroll scraping (scrollingScrapeOutput), consider a line changed
   if the new content is truncated relative to the content previously
   output.  Previously, we only compared against the line-buffer up to the
   current console width.  e.g.

   If this:
      |C:\Program|

   turns into:
      |C:\Prog|
      |ram    |

   we previously left |C:\Program| in the line-buffer for the first line
   and did not re-output the first line.

   We *should* reoutput the first line at this point so that, if the line
   scrolls upward, and the terminal is later expanded, we will have
   output an "Erase in Line" CSI command to clear the obscured "ram" text.

   We need to update the line-buffer for the sake of Windows 10 combined
   with terminals like xterm and putty.  On such a terminal, if the
   terminal later widened, Windows 10 will restore the console to the
   first state.  At that point, we need to reoutput the line, because
   xterm and putty do not save and restore truncated line content extending
   past the current terminal width.
2015-09-29 02:32:49 -05:00
Ryan Prichard
6c9c7bb985 Allow col and row to be specified to VeryLargeRead.cc and add server OSs 2015-09-26 00:13:31 -05:00
Ryan Prichard
9fc1b70fa4 Fix a character-handling defect in TestUtil.cc, startChildProcess
- Formatting a wchar_t* argument with %s does not work with MinGW's
   swprintf.  (Apparently it does with MSVC?  Sigh.)  AFAICT, %ls does
   the right thing with both MinGW and MSVC.  (I didn't test MSVC.)
2015-09-25 23:41:08 -05:00
Ryan Prichard
f4ef2a0d0b Document the largest allowed ReadConsoleOutputW call on various client OSs 2015-09-25 05:51:34 -05:00
Ryan Prichard
0907855b87 Make VeryLargeRead.cc work better on Windows XP.
Avoid zero-initializing the buffer to accommodate VMs that have
little RAM.  Use a smaller buffer size (9000x9000 ==> 324MB
buffer) that still demonstrates the read-size limit on XP.
2015-09-25 00:25:51 -07:00
Ryan Prichard
3a4a602ac8 Add a test case that performs a very large read. 2015-09-24 23:58:31 -07:00
Ryan Prichard
6121265f58 Refactor cursorPosition to use bufferInfo(). 2015-09-24 23:58:30 -07:00
Ryan Prichard
f605aaf4de Factor out a Win32Console::bufferInfo() function.
I don't know if this is necessary, but an atomic accessor function
returning buffer size and window position seems like it could be
convenient.
2015-09-24 23:58:29 -07:00
Ryan Prichard
6122f0d989 Expand on the Win10ResizeWhileFrozen comment. 2015-09-24 23:58:28 -07:00
Ryan Prichard
06a81be1fc Add a setCursorPos convenience function. 2015-09-24 23:58:26 -07:00
Ryan Prichard
fb95353703 Improve setSmallConsoleFontVista debug output 2015-09-24 05:43:40 -05:00
Ryan Prichard
bf34a4d8fa Rewrite Win32Console::setSmallFont for better Unicode compatibility.
Try to use a TrueType font rather than a raster font.  The strategy is:
 - [NEW] Try to use 6pt Consolas, then
 - [NEW] Try to use 6pt Lucida Console, then
 - Try to use the smallest font using SetCurrentConsoleFontEx, then
 - Try to use the smallest font using the undocumented SetConsoleFont
   XP API.

When a raster font is active, the console turns most/all non-ASCII
characters into '?' characters.  We need to select a TrueType font to
preserve these characters.
2015-09-24 05:09:40 -05:00
Ryan Prichard
bb5edfb2fd Add a test program that writes and reads a non-ASCII character. 2015-09-23 17:38:12 -05:00
Ryan Prichard
72557cb8c4 Read and write UTF-16, not Ascii. 2015-09-23 17:37:35 -05:00
Ryan Prichard
0f7a5656e3 Merge pull request #37 from dscho/fix-locale
Set the appropriate locale
2015-09-23 13:47:28 -05:00
Johannes Schindelin
ec385e8d1b Set the appropriate locale
By calling `setlocale(LC_ALL, "");`, we give the user a chance to
override the ASCII-only default so that non-ASCII arguments are
converted into UTF-16 properly, which is required to pass them
correctly to the actual Win32 executable.

This is necessary because POSIX dictates that we start up with the C
locale, ignoring all environment variables, until that `setlocale()`
call.

This fixes https://github.com/git-for-windows/git/issues/412

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2015-09-23 15:39:41 +00:00
Ryan Prichard
0c1e064172 Fix trivial_test
Apparently the non-w64 mingw32 does not have an swprintf function, though
it does have an snwprintf function.  In any case, the function takes a
second argument which is a buffer size.

Also include cwchar and cctype.

Print a message when building the test.
2015-08-23 23:13:20 -05:00
Ryan Prichard
6e696f8828 Allow winpty to function with a visible console.
* If a new window station can't be created, keep going anyway.  I *think*
   this is what IntelliJ's fork is doing.  Perhaps the window should be
   marked SW_HIDE in this case?

 * Rename WINPYDBG to WINPTY_DEBUG.

 * Add an environment variable WINPTY_SHOW_CONSOLE.  If non-empty, the
   console window is placed on the same window station and is visible.
   It's intended for testing purposes.
2015-08-23 23:13:20 -05:00
Ryan Prichard
6591f03d55 Include the sync marker counter in two debugging messages. 2015-08-23 23:13:20 -05:00
Ryan Prichard
947548215d When setting a sync marker, clear the lines containing the marker.
* This behavior is necessary for Windows 10 to ensure that line rewrapping
   does not corrupt the marker.
2015-08-23 23:13:20 -05:00
Ryan Prichard
ccd1406dd8 Add a test program demonstrating how to clear (part of) the console buffer. 2015-08-23 23:13:20 -05:00
Ryan Prichard
e123a4e7c8 Add a test program. 2015-08-23 16:02:23 -07:00
Ryan Prichard
95fe71a501 Add a few more experiments 2015-08-22 20:56:24 -07:00
Ryan Prichard
380828dee5 Add a test case demonstrating the Win10 hang on resize-during-selection 2015-08-21 14:45:50 -07:00
Ryan Prichard
9a9c148043 Remove trailing whitespace. 2014-09-17 14:57:03 -07:00
Ryan Prichard
1f95cce913 Change package name from gcc4-g++ to gcc-g++.
Thanks to shiek on GitHub for pointing this out.
2014-09-17 14:56:45 -07:00
Ryan Prichard
ce9f480e5c Remove trailing whitespace. 2014-09-17 14:55:28 -07:00
Ryan Prichard
d0e8764666 Work around what I think is a typo in a MinGW header.
Address the Cygwin part of GitHub issue 27.
2014-09-17 14:55:19 -07:00
Ryan Prichard
47a69d0d59 Merge pull request #26 from yol0/master
Fix configure for 64-bit Cygwin  and verified on recent Cygwin versions
2014-08-31 22:50:51 -07:00
Haoming Zhu
793ff925a2 Fix configure for 64-bit Cygwin. 2014-09-01 13:37:26 +08:00
Ryan Prichard
4e51f8ce17 Merge pull request #25 from cjfromthesea/patch-2
Include <algorithm> for std::min and std::max
2014-08-07 18:38:38 -07:00
Christian Howe
fd1e76de5d Include <algorithm> for std::min and std::max 2014-08-07 21:20:16 -04:00
Ryan Prichard
7b878ad2e8 Propagate the console title to the terminal. 2014-05-12 10:53:44 +01:00
Ryan Prichard
470fa4449a Merge pull request #15 from ustieber/patch-2-ConsoleMode
Add support for a non-terminal console mode
2013-12-07 15:10:32 -08:00
Uwe Stieber
c170d6167f Add support for a non-terminal console mode
If a process is running under control of winpty, the output of the process is decorated with ESC sequences to control a terminal to print the process output nicely. In some environments however, the client showing the output to the user is not a full terminal emulation, the Eclipse CDT debug console view in example, and the ESC sequences are printed as output additional to the real process output. This commit is adding an API function to switch into a mode where winpty is not decorating the process output with ESC sequences. The console mode is designated to pass on the process output to the client as is.
2013-12-06 15:32:23 +01:00
Ryan Prichard
bfc6336358 Merge pull request #14 from ustieber/patch-1-GetProcessId
Add API to access the process id of the started process
2013-09-24 04:39:36 -07:00
Uwe Stieber
6f1d6a5dbe Fixed indentation
Fixed indentation by replacing TABs by 4 spaces.
2013-09-24 13:37:00 +02:00
Uwe Stieber
d6498a63b8 Simplify patch by using GetProcessId
GetProcessId simplifies the code as it avoids to add the additional member variable 'm_childProcessId'. Cleaned up the indentation.
2013-09-24 13:11:48 +02:00
Uwe Stieber
03fbed5fc2 Add API to access the process id of the started process
Added new agent message "GetProcessId" and a API "winpty_get_process_id"
to allow access to the process id of the started process. The process id
is needed to integrate "winpty" with Eclipse CDT to launch native Windows
console applications inside the Eclipse UI.
2013-09-24 10:09:01 +02:00
Ryan Prichard
bd11b6581d Merge pull request #11 from sschuberth/master
Actually say which license this is (MIT)
2013-07-18 03:07:52 -07:00
Sebastian Schuberth
4f1ebbaba7 Actually say which license this is (MIT) 2013-07-18 10:22:22 +02:00