Windows build number: Microsoft Windows [Version 10.0.18363.535]
Windows Terminal version (if applicable): NA
Any other software? No
Properties->Terminal
μμ 컀μ λͺ¨μμ μ€μ ν ν Console.CursorVisible
λ₯Ό false
λ‘ μ€μ ν λ€μ true
λ₯Ό μ€μ νμ¬ μ»€μλ₯Ό μ¨κΈ°κ³ νμνλ©΄ 컀μ λͺ¨μμ΄ λ€μμΌλ‘ 볡μλ©λλ€. μ½μ νΈμ€νΈμ λ κ±°μ μ€νμΌ.
λ€μκ³Ό κ°μ κ°λ¨ν C # νλ‘κ·Έλ¨μ΄ λ¬Έμ λ₯Ό 보μ¬μ€ μ μμ΅λλ€.
using System;
using System.Text;
namespace cursorShape
{
class Program
{
static void Main(string[] args)
{
const string prompt = "PROMP> ";
StringBuilder sb = new StringBuilder();
int top = Console.CursorTop;
Console.OutputEncoding = Encoding.UTF8;
Console.Write(prompt);
while (true)
{
var key = Console.ReadKey();
if (key.Key == ConsoleKey.Q)
{
break;
}
sb.Append(key.KeyChar);
Console.CursorVisible = false; // Hide the cursor before rewriting
Console.SetCursorPosition(0, top);
Console.Write($"{prompt}{sb}");
Console.SetCursorPosition(Console.CursorLeft, top);
Console.CursorVisible = true; // Show the cursor afterwards
}
}
}
}
Console.CursorVisible
μ€μ μ 컀μ λͺ¨μμ λ λλ¦¬μ§ μμμΌν©λλ€.
컀μ λͺ¨μμ΄ Solid Box
μμ λ κ±°μ μ€νμΌ ( Underline
)λ‘ λλμκ°λλ€.
μ΄ λ κ°μ§ λ¬Έμ λ PowerShell + PSReadLine 컨ν
μ€νΈμμλ³΄κ³ λμμ΅λλ€. PSReadLineμ λ λλ§νλ λμ 컀μλ₯Ό μ¨κΈ°κ³ νμνκΈ° μν΄ Console.CursorVisible
μ μμ‘΄νλ―λ‘ μ»€μ λͺ¨μμ΄ λλμκ°λλ€.
μ, μ μ₯.
# 409μμ μ€λͺ
νλ―μ΄ λ¬Έμ λ SetConsoleCursorInfo
λ₯Ό νΈμΆνλ©΄ 컀μ ν¬κΈ°κ° μ€μ λκ³ μ»€μ ν¬κΈ°λ₯Ό μ€μ νλ©΄ 컀μ λͺ¨μμ΄ λ κ±°μ μ€νμΌλ‘ κ°μ μ μ©λλ€λ κ²μ
λλ€ (ν¬κΈ°κ° μ μ© κ°λ₯ν μ μΌν λͺ¨μμ΄κΈ° λλ¬Έμ AFAIK ).
"μμ "νλ κ²μ μ½μ΅λλ€. SetCursorInformation
λ©μλμμμ΄ μ€μ μμ ν μ μμ΅λλ€.
https://github.com/microsoft/terminal/blob/6f667f48ae109d4291cda1f8d4e977315c0dae8a/src/host/screenInfo.cpp#L1778
κ·Έλ¬λ μ΄λ κ³΅μ© APIμ λμ λ³κ²½μ΄λ©° μΌλΆ μμ© νλ‘κ·Έλ¨μ΄ μ€μ λ‘ ν΄λΉ λμμ μμ‘΄ ν μ μμ΅λλ€.
μ΄μμ μΌλ‘ Console.CursorVisible
μμ±μ κ°μμ±μ μ€μ νλ APIλ₯Ό μ¬μ©ν΄μΌνμ§λ§ λ€λ₯Έ κ²μ μ€μ νμ§ μλ κ²μ΄ μ’μ΅λλ€.νμ§λ§ κ·Έλ° κ²μ μλ€κ³ μκ°ν©λλ€. μ΅μ μ λ°©λ²μ VT μνμ€λ₯Ό μ¬μ©νλ κ²μ΄μ§λ§ μ΄μ λ²μ μ Windowsμμλ μλνμ§ μμ κ²μ
λλ€.
: tada :μ΄ λ¬Έμ λ # 5251μμ ν΄κ²°λμμΌλ©° νμ¬ Windows Terminal Preview v0.11.1121.0
. : tada :
νΈλ¦¬ν λ§ν¬ :
κ°μ₯ μ μ©ν λκΈ
: tada :μ΄ λ¬Έμ λ # 5251μμ ν΄κ²°λμμΌλ©° νμ¬
Windows Terminal Preview v0.11.1121.0
. : tada :νΈλ¦¬ν λ§ν¬ :