Terminal: μ»€μ„œλ₯Ό 숨기고 μ½˜μ†” 창에 λ‹€μ‹œ ν‘œμ‹œ ν•œ ν›„ μ»€μ„œ λͺ¨μ–‘이 λ ˆκ±°μ‹œ μŠ€νƒ€μΌλ‘œ λ˜λŒμ•„κ°‘λ‹ˆλ‹€.

에 λ§Œλ“  2020λ…„ 01μ›” 06일  Β·  3μ½”λ©˜νŠΈ  Β·  좜처: microsoft/terminal

ν™˜κ²½

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 )둜 λ˜λŒμ•„κ°‘λ‹ˆλ‹€.
linux

κ΄€λ ¨ 문제

409 및 # 1145 및 https://github.com/PowerShell/PSReadLine/issues/903

이 두 가지 λ¬Έμ œλŠ” PowerShell + PSReadLine μ»¨ν…μŠ€νŠΈμ—μ„œλ³΄κ³ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. PSReadLine은 λ Œλ”λ§ν•˜λŠ” λ™μ•ˆ μ»€μ„œλ₯Ό 숨기고 ν‘œμ‹œν•˜κΈ° μœ„ν•΄ Console.CursorVisible 에 μ˜μ‘΄ν•˜λ―€λ‘œ μ»€μ„œ λͺ¨μ–‘이 λ˜λŒμ•„κ°‘λ‹ˆλ‹€.

Area-Settings Issue-Bug Needs-Tag-Fix Product-Conhost Resolution-Fix-Committed

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

: tada :이 λ¬Έμ œλŠ” # 5251μ—μ„œ ν•΄κ²°λ˜μ—ˆμœΌλ©° ν˜„μž¬ Windows Terminal Preview v0.11.1121.0 . : tada :

νŽΈλ¦¬ν•œ 링크 :

λͺ¨λ“  3 λŒ“κΈ€

음, μ  μž₯.

# 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 :

νŽΈλ¦¬ν•œ 링크 :

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰