Skip to content

Commit

Permalink
chg - Hotfix release to fix more bugs
Browse files Browse the repository at this point in the history
---

Type: chg
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Sep 22, 2024
1 parent 84a683e commit 6b72770
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
7 changes: 2 additions & 5 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
This version of Terminaux is mostly informational, as it adds and tweaks features to the TermInfo parser!
This version of Terminaux is an emergency bug fix update.

### Changes

This release contains a variety of changes, including, but not limited to:

- `[+]` Added current and fallback TermInfo properties
- `[+]` Added value description classes
- `[*]` Improved extended capability parsing
- `[*]` General improvements and bug fixes
- `[*]` Fixed bugs when parsing old terminfo files

Review the commit history if you want to get a deep insight about the changes.

Expand Down
2 changes: 1 addition & 1 deletion CHANGES.TITLE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[release] Terminaux v5.3.0: More Info!
[servicing] Terminaux v5.3.0.1: More Info Revisited!
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>5.3.0</Version>
<Version>5.3.0.1</Version>
<Authors>Aptivi</Authors>
<Company>Aptivi</Company>
<Copyright>Copyright (c) 2022-2024 Aptivi</Copyright>
Expand Down
Binary file modified Terminaux.Tests/TermInfo/Data/eterm-256color
Binary file not shown.
Binary file modified Terminaux.Tests/TermInfo/Data/linux
Binary file not shown.
12 changes: 7 additions & 5 deletions Terminaux.Tests/TermInfo/TermInfoDataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void Should_Read_Extended_Capabilities()
info.Names.Length.ShouldBe(2);
info.Names[0].ShouldBe("Eterm-256color");
info.Names[1].ShouldBe("Eterm with xterm 256-colors");
info.Extended.Count.ShouldBe(20);
info.Extended.Count.ShouldBe(26);
var ax = info.Extended.GetBoolean("AX");
var xt = info.Extended.GetBoolean("XT");
var kup = info.Extended.GetString("kUP");
Expand All @@ -106,17 +106,19 @@ public void Should_Read_Extended__Capabilities_Without_String_Values()
// Then
info.Names.Length.ShouldBe(2);
info.Names[0].ShouldBe("linux");
info.Names[1].ShouldBe("Linux console");
info.Extended.Count.ShouldBe(4);
info.Names[1].ShouldBe("linux console");
info.Extended.Count.ShouldBe(10);
var ax = info.Extended.GetBoolean("AX");
var g0 = info.Extended.GetBoolean("G0");
var xt = info.Extended.GetBoolean("XT");
var u8 = info.Extended.GetNum("U8");
ax.ShouldNotBeNull();
g0.ShouldBeNull();
xt.ShouldBeNull();
g0.ShouldNotBeNull();
xt.ShouldNotBeNull();
u8.ShouldNotBeNull();
ax.Value.ShouldBe(true);
g0.Value.ShouldBe(false);
xt.Value.ShouldBe(false);
u8.Value.ShouldBe(1);
}

Expand Down
2 changes: 1 addition & 1 deletion Terminaux/Base/TermInfo/Parsing/ByteReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Terminaux.Base.TermInfo.Parsing
{
internal sealed class ByteReader
{
private readonly BinaryReader _reader;
internal readonly BinaryReader _reader;

public int Position { get; set; }

Expand Down
12 changes: 10 additions & 2 deletions Terminaux/Base/TermInfo/Parsing/TermInfoParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,20 @@ private static ExtendedCapabilities ParseExtendedCaps(ByteReader reader, BitWidt
if (index == -2 || index == -1)
invalidIndexes++;
}
if (invalidIndexes > 0)
byte[] twoBytes = reader.ReadBytes(2);
int resultant = twoBytes[1] << 8 | twoBytes[0];
bool isIdx = resultant < header[ExtTableSize];
if (isIdx)
{
indexList.Add(resultant);
invalidIndexes--;
}
if (invalidIndexes > 0 && isIdx)
indexList.AddRange(ReadIntegers(reader, invalidIndexes, BitWidth.TwoBytes));
var indices = new Span<int>([.. indexList]);

// Read the data
var data = new Span<char>(Encoding.ASCII.GetString(reader.ReadBytes(header[ExtTableSize])).ToCharArray());
var data = new Span<char>(($"{(isIdx ? "" : new string([(char)twoBytes[0], (char)twoBytes[1]]))}" + Encoding.ASCII.GetString(reader.ReadBytes(header[ExtTableSize] - (isIdx ? 0 : 2)))).ToCharArray());

// Read string caps
var (strings, last) = ReadStrings(indices, data, header[ExtStringCount]);
Expand Down

0 comments on commit 6b72770

Please sign in to comment.