Skip to content

Commit

Permalink
Added minor improvements and update latest unicode spec (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
shibayan authored Nov 12, 2022
1 parent 9daacad commit 9fbe6e9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Sharprompt/Forms/ConfirmForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ private bool HandleEnter(out bool result)
else
{
if (input.Equals(Resource.ConfirmForm_Answer_Yes, StringComparison.OrdinalIgnoreCase) ||
input.Equals(Resource.ConfirmForm_Answer_Yes.Remove(1), StringComparison.OrdinalIgnoreCase))
input.Equals(Resource.ConfirmForm_Answer_Yes[..1], StringComparison.OrdinalIgnoreCase))
{
result = true;

return true;
}

if (input.Equals(Resource.ConfirmForm_Answer_No, StringComparison.OrdinalIgnoreCase) ||
input.Equals(Resource.ConfirmForm_Answer_No.Remove(1), StringComparison.OrdinalIgnoreCase))
input.Equals(Resource.ConfirmForm_Answer_No[..1], StringComparison.OrdinalIgnoreCase))
{
result = false;

Expand Down
2 changes: 1 addition & 1 deletion Sharprompt/Forms/MultiSelectForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected override void InputTemplate(OffscreenBuffer offscreenBuffer)
}
}

if (_paginator.PageCount > 1 && _options.Pagination is not null)
if (_paginator.PageCount > 1)
{
offscreenBuffer.WriteLine();
offscreenBuffer.WriteHint(_options.Pagination(_paginator.TotalCount, _paginator.SelectedPage + 1, _paginator.PageCount));
Expand Down
2 changes: 1 addition & 1 deletion Sharprompt/Forms/SelectForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected override void InputTemplate(OffscreenBuffer offscreenBuffer)
}
}

if (_paginator.PageCount > 1 && _options.Pagination is not null)
if (_paginator.PageCount > 1)
{
offscreenBuffer.WriteLine();
offscreenBuffer.WriteHint(_options.Pagination(_paginator.TotalCount, _paginator.SelectedPage + 1, _paginator.PageCount));
Expand Down
23 changes: 11 additions & 12 deletions Sharprompt/Internal/EastAsianWidth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ private static bool IsFullWidth(uint codePoint)
new(11931, 88, false),
new(12032, 213, false),
new(12272, 11, false),
new(12288, 0, false),
new(12289, 61, false),
new(12288, 62, false),
new(12353, 85, false),
new(12441, 102, false),
new(12549, 42, false),
Expand Down Expand Up @@ -301,7 +300,9 @@ private static bool IsFullWidth(uint codePoint)
new(110581, 6, false),
new(110589, 1, false),
new(110592, 290, false),
new(110898, 0, false),
new(110928, 2, false),
new(110933, 0, false),
new(110948, 3, false),
new(110960, 395, false),
new(126980, 0, false),
Expand Down Expand Up @@ -341,23 +342,21 @@ private static bool IsFullWidth(uint codePoint)
new(128716, 0, false),
new(128720, 2, false),
new(128725, 2, false),
new(128733, 2, false),
new(128732, 3, false),
new(128747, 1, false),
new(128756, 8, false),
new(128992, 11, false),
new(129008, 0, false),
new(129292, 46, false),
new(129340, 9, false),
new(129351, 184, false),
new(129648, 4, false),
new(129656, 4, false),
new(129664, 6, false),
new(129680, 28, false),
new(129712, 10, false),
new(129728, 5, false),
new(129744, 9, false),
new(129760, 7, false),
new(129776, 6, false),
new(129648, 12, false),
new(129664, 8, false),
new(129680, 45, false),
new(129727, 6, false),
new(129742, 13, false),
new(129760, 8, false),
new(129776, 8, false),
new(131072, 65533, false),
new(196608, 65533, false),
new(917760, 239, true),
Expand Down
2 changes: 1 addition & 1 deletion Sharprompt/Prompt.Bind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static void StartBind<T>(T model) where T : notnull
FormType.MultiSelect => MakeMultiSelect(propertyMetadata),
FormType.Password => MakePassword(propertyMetadata),
FormType.Select => MakeSelect(propertyMetadata),
_ => null
_ => throw new ArgumentOutOfRangeException()
};

propertyMetadata.PropertyInfo.SetValue(model, result);
Expand Down

0 comments on commit 9fbe6e9

Please sign in to comment.