Commit Graph

315 Commits

Author SHA1 Message Date
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
Ryan Prichard
878ceba45d Remove CRLF line endings from README.rst.
* None of the other text files in the repository have CRLF line endings.
2012-12-20 04:20:11 -08:00
Ryan Prichard
274086bbf5 In winpty-agent, print an error message if the arguments are invalid.
* Some users might think they could run winpty-agent.exe.

 * Right now, when I run winpty-agent.exe from a cmd.exe command prompt
   window, it looks like winpty-agent.exe is segfaulting.  It *ought* to
   print an assertion failed dialog box.
2012-12-20 04:20:10 -08:00
Ryan Prichard
91ccab1443 Add a gyp project that can build winpty-agent and libwinpty.dll with MSVC.
Peter Rekdal submitted the original version of this file.  I made some
minor changes.

Update the .gitignore file to ignore files generated by building winpty
with MSVC.
2012-12-20 04:20:09 -08:00
Ryan Prichard
d02cccb256 MSVC compatibility: Remove the {Agent,WinPty}DebugClient.cc hack.
* With this hack, it's impossible to add all the .cc files to an MSVC
   project, because MSVC understandably thinks that
   agent/AgentDebugClient.cc and shared/DebugClient.cc are two separate
   C++ translation units.  I could rename DebugClient.cc, but it's better
   to just fix the problem with the Makefile.
2012-12-20 04:07:57 -08:00
Ryan Prichard
41e7c31387 MSVC compatibility: Deal with snprintf and vsnprintf.
* When building with MSVC, there is no snprintf function, but there are
   _snprintf, vsnprintf, and _vsnprintf functions (as well as many
   variations on these).  The MSVC _snprintf is not the same as C99's
   snprintf, and in particular, it does not guarantee that the buffer is
   NUL-terminated, whereas C99 does guarantee this.  I want the C99
   behavior, so add a c99_[v]snprintf functions in shared/c99_snprintf.h
   that provide C99 behavior.

 * Details:
   http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
2012-12-20 04:07:56 -08:00
Ryan Prichard
549472ec78 unix-adapter: Link statically with cyggcc_s-1.dll and cygstdc++-6.dll.
* At least for now, I'm shipping Cygwin/MSYS binaries.  On Cygwin (but
   not MSYS), the console.exe executable previously linked dynamically
   to cyggcc_s-1.dll and cygstdc++-6.dll.

   Linking dynamically with cygstdc++-6.dll seems risky for a binary
   not distributed by Cygwin, because G++'s Windows ABI is unstable, at
   least as of G++ 4.7, which turned on the __thiscall calling
   convention.  If a binary I ship ever comes into contact with a
   4.7-versioned cygstdc++-6.dll, then my binary will (very likely)
   segfault.

   So far, I've only observed this ABI incompatibility with MinGW,
   where a sufficiently upgraded MinGW configuration comes with a
   libstdc++-6.dll that is completely incompatible with every previous
   libstdc++-6.dll, so that every program built against the older
   libstdc++-6.dll segfaults immediately.  For now, Cygwin seems stuck
   at G++ 4.5, and my impression (possibly incorrect), is that G++'s
   Windows ABI was stable prior to 4.7.  I think G++'s Linux ABI is
   stable.  Presumably Cygwin will eventually update its compiler,
   though, so it makes sense to fix the problem early.

   I believe I originally chose to dynamically link the libraries
   because it was the default behavior, and I was afraid that a
   non-default option would break something.  It turns out that
   linking statically with cygstdc++-6 *does* break something -- it
   causes linker errors if the code uses std::cerr.  The workaround
   is not to use std::cerr.  This is not a problem for the
   unix-adapter, which already has to put up with MSYS' gimpy G++ 3.4
   compiler.
2012-12-20 04:07:55 -08:00
Ryan Prichard
bb42d17941 Copy the Unix environment to the Win32 environment in the unix-adapter.
This should fix issue 5.

The copying appeared to be necessary only for Cygwin, not for MSYS.  I'm
not sure why this is.  I added a call to cygwin_internal(CW_SYNC_WINENV)
for both anyway, because I didn't think it would hurt.
2012-07-29 00:35:24 +01:00
Ryan Prichard
9b09d3230f Merge pull request #4 from holtrop/master
added an "install" Makefile target
2012-07-13 00:41:04 -07:00
Josh Holtrop
31798422d2 add "install" Makefile target 2012-07-11 14:50:51 -04:00
Ryan Prichard
951729a26d Merge pull request #2 from jkells/master
README Update
2012-05-15 01:41:24 -07:00
Jared Kells
336153418e Typo / Formatting 2012-05-15 09:05:47 +10:00
Jared Kells
6fc6f89b0b Update README file. Provide details of required MinGW packages. 2012-05-14 11:13:10 +10:00
Ryan Prichard
9b66d2cb9c Add a distclean target that removes the files configure creates. 2012-04-17 09:50:19 -07:00
Ryan Prichard
2ebc715c28 Add a toplevel license file and remove the misc one. 2012-04-17 09:50:07 -07:00
Ryan Prichard
0dccfd42e1 Fix edge cases in argvToCommandLine's argument quoting.
* Quoting is needed for empty arguments (i.e. put double-quotes in the
   command line) and for arguments containing tabs because both spaces and
   tabs can separate arguments.

 * A double-quote in the argument doesn't by itself necessitate quoting.

 * As of this change, argvToCommandLine quotes an argument in the same
   cases as Python's subprocess module.
2012-04-03 01:13:08 -07:00
Ryan Prichard
794b07e526 In the unix-adapter, convert a POSIX executable path to a Win32 path. 2012-04-01 19:15:35 -07:00
Ryan Prichard
a7bc8fcf9d Rename Shared to shared and Misc to misc. 2012-04-01 02:13:21 -07:00
Ryan Prichard
17eaaadcec Use 4-space indentation in Misc/UnixEcho.cc. 2012-04-01 02:03:12 -07:00
Ryan Prichard
8eb2da5850 Fix a typo. 2012-04-01 02:00:37 -07:00
Ryan Prichard
9f26d1fc1e Remove a TODO comment for a completed task. 2012-04-01 01:42:50 -07:00