Skip to content

Commit

Permalink
found a cool site, futzed with logging
Browse files Browse the repository at this point in the history
  • Loading branch information
doubleyewdee committed Oct 25, 2018
1 parent 8d1a95c commit ab4d472
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
- VT codes doc: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
- Sample for ConPTY: https://github.com/Microsoft/console/tree/master/samples/ConPTY/EchoCon
- Win32 APIs: WinBase.h, ProcessEnv.h, consoleapi.h
- Calculating size of a textbox: https://stackoverflow.com/questions/9264398/how-to-calculate-wpf-textblock-width-for-its-known-font-size-and-characters
- Calculating size of a textbox: https://stackoverflow.com/questions/9264398/how-to-calculate-wpf-textblock-width-for-its-known-font-size-and-characters
- a random fun site: http://wiki.bash-hackers.org/scripting/terminalcodes
3 changes: 2 additions & 1 deletion src/ConsoleBuffer/Buffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public void Append(byte[] bytes, int length)
{
lock (this.renderLock)
{
foreach (char ch in Encoding.UTF8.GetString(bytes, 0, length))
for (var i = 0;i < length; ++i)
{
var ch = (char)bytes[i];
if (ch == '\n')
{
Logger.Verbose($"newline (current: {this.lines[this.currentLine]})");
Expand Down
4 changes: 3 additions & 1 deletion src/ConsoleBuffer/ConsoleWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ private void ReadConsoleTask()
{
Logger.Verbose("reading ...");
var read = ptyOutput.Read(input, 0, input.Length);
Logger.Verbose("appending ...");
if (read == 0) continue;

Logger.Verbose($"appending {read} bytes...");
this.Buffer.Append(input, read);
Logger.Verbose("notifying ...");
this.OnPropertyChanged(nameof(this.Buffer));
Expand Down

0 comments on commit ab4d472

Please sign in to comment.