Commit Graph

551 Commits

Author SHA1 Message Date
Ryan Prichard
5b99238fca Don't show the cursor if it is outside the console window
Fixes https://github.com/rprichard/winpty/issues/113
2017-04-22 23:41:22 -07:00
Ryan Prichard
bae43674b1 Update release notes 2017-04-22 22:09:36 -07:00
Ryan Prichard
ac33b66172 Direct mode: invalidate m_bufferData on resize
Also, for efficieny in direct mode, only output the lines that have
changed, rather than reprinting all of the lines after the first changed
line.

Fixes https://github.com/rprichard/winpty/issues/112
2017-04-22 22:05:16 -07:00
Ryan Prichard
d636a1de86 Synthesize a WINDOW_BUFFER_SIZE_EVENT event after winpty is resized
Fixes https://github.com/rprichard/winpty/issues/110.
2017-04-22 14:57:35 -07:00
Ryan Prichard
838d959579 Update the release notes 2017-04-22 03:11:58 -05:00
Ryan Prichard
201d8aeb3a Fix handling of AltGr keys
* Respect the result of VkKeyScan when it returns multiple modifiers.  I
   *think* the old if-else behavior was a typo?

 * Refactor the code to restrict the scope of the Alt-implies-NUL behavior.
   On my US keyboard, if I press either Alt-P or Alt-Ctrl-P, the console
   reports a VirtualKey of 'P', and a NUL codepoint for KeyUp.  For KeyDown,
   though, Alt-P reports a 'P' codepoint, but Alt-Ctrl-P reports a NUL
   codepoint.  winpty previously implemented this logic in appendKeyPress, but
   now it's factored out.

   If the terminal sends us U+20AC (EURO SIGN), VkKeyScan decides that it must
   have been typed using both Ctrl and Alt.  (Pressing Ctrl-LeftAlt-E on my US
   keyboard produces a Euro, as does RightAlt-E; AltGr/RightAlt seems to imply
   Ctrl.)  If the Alt keypress only comes from VkKeyScan, then continue using
   the proper codepoint.

 * Avoid changing the VT/reencoding behavior.  In appendUtf8Char, pass the
   unadjusted codepoint and Alt-escape to appendKeyPress, which will pass it
   to reencodeEscapedKeyPress if the console is using VT input.

Fixes https://github.com/rprichard/winpty/issues/109
2017-04-22 03:11:58 -05:00
Ryan Prichard
6360ec6a5b Add test case demonstrating a Win10 15048 ReadConsoleOutput bug 2017-03-16 20:57:35 -05:00
Ryan Prichard
47e7e005e8 Change program execution: resolve symlinks and do PATH search explicitly
Fixes https://github.com/rprichard/winpty/issues/81
Fixes https://github.com/rprichard/winpty/issues/98
2017-02-01 20:48:43 -06:00
Ryan Prichard
75301a2703 Stop building the MSYS package
See https://github.com/rprichard/winpty/issues/97
2017-02-01 17:53:21 -06:00
Ryan Prichard
9f900cc152 Debug output: when virtualkey is 0, print 0 rather than 0x0 2017-01-31 22:06:06 -06:00
Ryan Prichard
ed9d5ad158 Use hex for scan code --show-input debug output 2017-01-31 22:05:24 -06:00
Ryan Prichard
bf98ff3c20 Add a test program that dumps console input via _getch. 2017-01-31 22:03:52 -06:00
Ryan Prichard
84016539f3 Set the ENHANCED_KEY key state for these keys:
* Arrow keys (up, down, left, right)
 * The block of 6 keys (insert, delete, home, end, pgup, pgdn)

This change fixes arrow keys in the Ruby REPL (irb)

Fixes https://github.com/rprichard/winpty/issues/99
2017-01-31 21:53:26 -06:00
Ryan Prichard
db874f4a70 Bump version 2017-01-18 05:35:39 -06:00
Ryan Prichard
410d634987 Set version to 0.4.2 2017-01-18 05:02:24 -06:00
Ryan Prichard
a703349883 Put the commit hash into the msvc binary package 2017-01-18 04:57:11 -06:00
Ryan Prichard
9fcad3a144 ship: make it easier to spot-check packages by leaving package dirs around 2017-01-18 04:55:55 -06:00
Ryan Prichard
1ad7e4eed8 Release notes for 0.4.2 2017-01-18 02:42:52 -06:00
Ryan Prichard
a674301a4b Fix a build problem with MSYS2 by adding a missing header 2017-01-18 01:29:39 -06:00
Ryan Prichard
eed0b3bd71 Get the code compiling with the latest MinGW.org toolchain.
(MinGW-w64 works already -- only the old MinGW toolchain had trouble.)

 * We need to build the test case with -std=g++11 to provide vsnprintf,
   even though vsnprintf is in C99 and is provided by both MSVC and
   MinGW-w64.

 * The old MinGW provides a non-conforming swprintf.
2017-01-18 01:25:10 -06:00
Ryan Prichard
67a34b6c03 Build system: redo how version number tracking works
* Remove the "version suffix" and BUILD_INFO.txt mechanisms, which I
   believe no one uses except winpty itself.  Instead, a suffix can be
   added in the VERSION.txt file.

 * Instead of passing the version and commit info as a preprocessor macro
   when building every C++ file, write the info into a GenVersion.h
   header that is only included by WinptyVersion.cc.

 * Instead of writing a BUILD_INFO.txt in ship.py, pass COMMIT_HASH=<hash>
   to make.

These changes accomplish two things:

 * People who build a tag from source won't see a "<ver>-dev" suffix
   anymore.

 * Changing the version or the commit will correctly rebuild the version
   object files (and only those object files).  It will also relink every
   binary.

Fixes https://github.com/rprichard/winpty/issues/72
2017-01-17 23:39:14 -06:00
Ryan Prichard
643e14894a Remove an obsolete comment. 2017-01-17 21:50:34 -06:00
Ryan Prichard
36d6a4d82e Support the COMMON_LVB_REVERSE_VIDEO and COMMON_LVB_UNDERSCORE flags
These flags are used with WSL (Bash on Windows) and are commonly used.
(e.g. a pager status bar, man pages, etc.)

The most difficult part of this commit is figuring out when Windows
respects the flags versus ignores them.  Apparently it deliberately
ignores them for backwards-compatibility with some programs.
2017-01-15 06:36:18 -06:00
Ryan Prichard
40d5b72c43 Pass certain keys to the console using windows messages.
If the terminal is placed in an alternate mode using DECCKM, then we
need to generate different input escape sequences for WSL (and other
programs using ENABLE_VIRTUAL_TERMINAL_INPUT).  AFAIK, there is no way
for winpty to detect whether an alternate mode is enabled, but it only
seems to affect a small number of keys, so send those keys as window
messages.

We don't send *all* keys as window messages, because the console may try
to interpret some of them.  It doesn't interpret the arrow keys and
Home/End, AFAICT, and those seem to be the only keys affected by DECCKM.
(The console's line-input mode *does* care about these navigation keys,
but in that case, WriteConsoleInput and window messages work equally well.)

DECCKM only seems to affect the keys when there is no modifier key.

I believe that by using SendMessage, winpty-agent will block until the
keys are appended to the console input buffer.  I'm not sure how to verify
it.  If this *weren't* the case, there could be a danger of key input
being transposed.  It seems unlikely to be an issue.

Fixes https://github.com/rprichard/winpty/issues/90
2017-01-15 04:20:05 -06:00
Ryan Prichard
27dfaaefb6 Bump version to 0.4.2 2017-01-03 23:08:15 -06:00
Ryan Prichard
ff8e67d313 Update release notes for 0.4.1. 2017-01-03 22:16:54 -06:00
Ryan Prichard
a850639a87 Fix various MSVC 2015 /W3 warnings
* The compiler doesn't like implicit conversions to bool.
   (it emits a "performance warning")

 * It also doesn't like an unused argument in an exception catch block.
2017-01-03 20:51:29 -06:00
Ryan Prichard
9f0d7e6b4e Add an assertion check in readAll
If the assertion could fail somehow, we could have memory unsafety.
2017-01-03 20:18:29 -06:00
Ryan Prichard
91fce49ab1 Respect the pos parameter in WriteBuffer::replaceRawData
This omission didn't actually break anything, because `pos` is always
0.
2016-10-19 23:05:37 -05:00
Ryan Prichard
68c0c140b2 Fix a read-from-end-of-buffer issue
Fixes https://github.com/rprichard/winpty/issues/94
2016-10-19 23:04:45 -05:00
Ryan Prichard
d02e42d815 Largely cosmetic: avoid a 0-size WriteConsoleInput call 2016-08-14 00:48:55 -05:00
Ryan Prichard
d9935eb21f Improve Ctrl-D detection for winpty-agent --show-input test mode. 2016-08-13 22:59:34 -05:00
Ryan Prichard
4a2ff5da03 Add new test programs: ConinMode, ConoutMode, WriteConsole 2016-08-13 22:12:18 -05:00
Ryan Prichard
6c994460a3 Stylistic change: Add C++11 override keywords everywhere possible.
GCC 5.1 added a -Wsuggest-override option that reports missing `override`
keywords, which I used to prepare this commit.  I'm not turning the option
on yet, though, because my Cygwin environment is still using GCC 4.9.
2016-07-24 00:21:10 -05:00
Ryan Prichard
30d59523ed Stylistic change: put a space between a macro and an opening double-quotes
Initially, some of this code omitted a space between a closing
double-quotes and a macro, which broke with C++11:

    m_output.write(CSI"0m"CSI"1;1H"CSI"2J");

To make it work with C++11, it changed to:

    m_output.write(CSI"0m" CSI"1;1H" CSI"2J");

Now I'm fully separating them:

    m_output.write(CSI "0m" CSI "1;1H" CSI "2J");

I don't expect C++ to change again, breaking my code, but it seems prudent
to avoid that possibility.

I searched the codebase for matches using this Sublime/Perl regex:

    ^([^"'\n]*("([^\\"\n]|\\.)*"|'([^\\'\n]|\\.)*'))*[^"'\n]*(?<!^)(?<!\bL)(?<=[A-Za-z0-9_])("([^\\"\n]|\\.)*"|'([^\\'\n]|\\.)*')
2016-07-23 23:49:45 -05:00
Ryan Prichard
18d71a73f2 Bump the version to 0.4.1 2016-06-28 23:54:45 -05:00
Ryan Prichard
c66253e782 Update release notes for 0.4.0. 2016-06-28 22:37:09 -05:00
Ryan Prichard
a0e3f337c0 Add a misc/IdentifyConsoleWindow.ps1 test script
It determines:
 - whether the program has a console
 - whether that console has a window
 - whether that window is on the current window station

It's motivated by the IntelliJ clipboard/winpty bug.
2016-06-20 00:15:53 -05:00
Ryan Prichard
fb8fb49c46 Update API documentation 2016-06-15 14:03:34 -05:00
Ryan Prichard
d7290359d5 Minor tweaks in ship/make_msvc_package.py
- Fix a typo in the 7-Zip default paths.

 - Change env["Path"] to env["PATH"].  Python is case-sensitive, and "Path"
   isn't working.  Windows itself seems to prefer "Path".  I'm guessing
   Python is converting "Path" to "PATH" for platform interoperability.
2016-06-14 05:38:09 -05:00
Ryan Prichard
c6603f72f5 Replace an ASSERT(false) with an exception
This code path only occurs if the start-process reply packet has an
unexpected value in it, so it should never occur.  If it somehow did,
though, it would be inconsistent (and poor behavior) to crash the process
using libwinpty.
2016-06-14 02:59:52 -05:00
Ryan Prichard
ac99610234 Put AgentDesktop into an anonymous namespace 2016-06-14 02:59:52 -05:00
Ryan Prichard
86d47df74b On RPC I/O failure, close the control pipe (which kills the agent)
- Also: ensure that the duplication of the process/thread handles can't
   leak a handle.
2016-06-14 02:59:33 -05:00
Ryan Prichard
fab4f7bb62 Code cleanup: remove a bunch of obsolete TODO comments 2016-06-14 01:07:32 -05:00
Ryan Prichard
b542453ce6 Code cleanup: propagate the LastError info more explicitly 2016-06-14 00:42:23 -05:00
Ryan Prichard
37624c05f4 Add a tea-ci badge to the README 2016-06-14 00:03:47 -05:00
Ryan Prichard
f872ded72c DebugClient improvements: preserve LastError and add TRACE() macro
TRACE() is like trace() but only evaluates its arguments when tracing is
enabled.

In various places on the default code path, where arguments are expensive
to evaluate, switch trace() to TRACE().
2016-06-13 23:50:38 -05:00
Ryan Prichard
913e8cbc71 Merge pull request #83 from fracting/tea-ci
Continuous Integration: Add build configure for Tea CI.
2016-06-13 23:04:26 -05:00
Qian Hong
22b42e29ee Continuous Integration: Add build configure for Tea CI. 2016-06-14 11:50:59 +08:00
Ryan Prichard
ac5d8e95e7 GetConsolePos: also print the cursor position 2016-06-10 01:15:22 -05:00