-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f042295
commit 95839d7
Showing
7 changed files
with
255 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,36 @@ | ||
using System; | ||
|
||
namespace ConsoleBuffer.Commands | ||
{ | ||
public sealed class EraseInDisplay : ControlSequence | ||
{ | ||
public EraseInDisplay(string bufferData) : base(bufferData) { } | ||
public enum Parameter | ||
{ | ||
Below = 0, | ||
Above, | ||
All, | ||
// xterm supports '3' for saved lines. | ||
Unknown, | ||
} | ||
|
||
public Parameter Direction { get; private set; } | ||
|
||
public EraseInDisplay(string bufferData) : base(bufferData) | ||
{ | ||
this.Direction = Parameter.Unknown; | ||
if (this.IsExtended) | ||
{ | ||
return; // extended means selective erase which we don't support. | ||
} | ||
if (this.Parameters.Count == 0) | ||
{ | ||
this.Direction = Parameter.Below; | ||
} | ||
if (this.Parameters.Count == 1 && uint.TryParse(this.Parameters[0], out var param)) | ||
{ | ||
param = Math.Min((uint)Parameter.Unknown, param); | ||
this.Direction = (Parameter)param; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace ConsoleBuffer.Commands | ||
{ | ||
public sealed class SetMode : ControlSequence | ||
{ | ||
/// <summary> | ||
/// True if the command was to set (not reset) the parameter. | ||
/// </summary> | ||
public bool Set { get; private set; } | ||
public enum Parameter | ||
{ | ||
CursorShow = 0, | ||
CursorBlink, | ||
Unknown, | ||
} | ||
|
||
public Parameter Setting { get; private set; } | ||
|
||
public SetMode(string bufferData, bool set) : base(bufferData) | ||
{ | ||
this.Set = set; | ||
this.Setting = Parameter.Unknown; | ||
|
||
if (!this.IsExtended) | ||
{ | ||
return; | ||
} | ||
|
||
if (this.Parameters.Count == 1) | ||
{ | ||
switch (this.Parameters[0]) | ||
{ | ||
case "12": | ||
this.Setting = Parameter.CursorBlink; | ||
break; | ||
case "25": | ||
this.Setting = Parameter.CursorShow; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.