Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: If a text contains non-ASCII chars, some chars remain in a line. #9

Merged
merged 3 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: '5.0.x'

# Build
- run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: '5.0.x'

- name: "dotnet build & pack"
run: |
Expand Down
12 changes: 12 additions & 0 deletions Kurukuru.Sample/Kurukuru.Sample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Kurukuru\Kurukuru.csproj" />
</ItemGroup>

</Project>
34 changes: 34 additions & 0 deletions Kurukuru.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Threading.Tasks;

namespace Kurukuru.Sample
{
class Program
{
static async Task Main(string[] args)
{
System.Console.OutputEncoding = System.Text.Encoding.UTF8;

using (var spinner = new Spinner("Initializing...", Patterns.Dots12))
{
spinner.Start();
await Task.Delay(2000);
spinner.Succeed();
}

await Spinner.StartAsync("ユーザー Alice でログインを試みています…", async spinner =>
{
await Task.Delay(1000);
spinner.Text = "こんにちは Alice!";
});


await Spinner.StartAsync("Executing some heavy task...", async () =>
{
await Task.Delay(3000);
throw new Exception();
});

}
}
}
6 changes: 6 additions & 0 deletions Kurukuru.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Actions", "GitHub Ac
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kurukuru.Sample", "Kurukuru.Sample\Kurukuru.Sample.csproj", "{6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -26,6 +28,10 @@ Global
{43150AB2-3041-4EC2-B17D-B8F6D3913561}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43150AB2-3041-4EC2-B17D-B8F6D3913561}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43150AB2-3041-4EC2-B17D-B8F6D3913561}.Release|Any CPU.Build.0 = Release|Any CPU
{6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6ECE0EE4-88FC-4968-801F-FAFD4BCDE882}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions Kurukuru/ConsoleHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Kurukuru
{
Expand Down Expand Up @@ -36,7 +36,7 @@ public static void ClearCurrentConsoleLine(int length)

int currentLineCursor = Console.CursorTop;
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write(new string(' ', length));
Console.Write(new string(' ', Console.WindowWidth));
Console.SetCursorPosition(0, currentLineCursor);
Console.Out.Flush();
}
Expand Down