요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
Software cursor for VGA
=======================
by Pavel Machek <[email protected]>
and Martin Mares <[email protected]>
Linux now has some ability to manipulate cursor appearance. Normally,
you can set the size of hardware cursor. You can now play a few new
tricks: you can make your cursor look like a non-blinking red block,
make it inverse background of the character it's over or to highlight
that character and still choose whether the original hardware cursor
should remain visible or not. There may be other things I have never
thought of.
The cursor appearance is controlled by a ``<ESC>[?1;2;3c`` escape sequence
where 1, 2 and 3 are parameters described below. If you omit any of them,
they will default to zeroes.
first Parameter
specifies cursor size::
0=default
1=invisible
2=underline,
...
8=full block
+ 16 if you want the software cursor to be applied
+ 32 if you want to always change the background color
+ 64 if you dislike having the background the same as the
foreground.
Highlights are ignored for the last two flags.
second parameter
selects character attribute bits you want to change
(by simply XORing them with the value of this parameter). On standard
VGA, the high four bits specify background and the low four the
foreground. In both groups, low three bits set color (as in normal
color codes used by the console) and the most significant one turns
on highlight (or sometimes blinking -- it depends on the configuration
of your VGA).
third parameter
consists of character attribute bits you want to set.
Bit setting takes place before bit toggling, so you can simply clear a
bit by including it in both the set mask and the toggle mask.
Examples
--------
To get normal blinking underline, use::
echo -e '\033[?2c'
To get blinking block, use::
echo -e '\033[?6c'
To get red non-blinking block, use::
echo -e '\033[?17;0;64c'
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Software cursor for VGA
1-48Pavel Machek와 Martin Mares가 작성한 VGA software cursor 안내입니다. Linux는 hardware cursor 크기뿐 아니라 모양도 조작할 수 있습니다. 깜박이지 않는 red block, 현재 문자의 background를 반전하는 cursor, 문자를 highlight하는 cursor를 만들 수 있고, 원래 hardware cursor를 계속 보일지도 선택할 수 있습니다.
cursor 모양은 `<ESC>[?1;2;3c` escape sequence로 제어합니다. 세 parameter 중 생략한 값은 `0`이 됩니다.
첫 번째 parameter는 cursor 크기와 software cursor 동작 flag를 지정합니다.
0=default
1=invisible
2=underline,
...
8=full block
+ 16 if you want the software cursor to be applied
+ 32 if you want to always change the background color
+ 64 if you dislike having the background the same as the
foreground.
마지막 두 flag에는 highlight가 적용되지 않습니다. 두 번째 parameter는 바꿀 문자 attribute bit를 고르며, 그 값과 기존 attribute를 XOR합니다. 표준 VGA에서는 상위 4bit가 background, 하위 4bit가 foreground입니다. 각 그룹의 하위 3bit는 console color code와 같은 색을 정하고 최상위 bit는 VGA 설정에 따라 highlight 또는 blinking을 켭니다.
세 번째 parameter는 설정할 문자 attribute bit mask입니다. bit setting이 toggling보다 먼저 일어나므로, 같은 bit를 set mask와 toggle mask 양쪽에 넣으면 그 bit를 간단히 지울 수 있습니다.
Examples
49-62일반적으로 깜박이는 underline cursor:
echo -e '\033[?2c'
깜박이는 block cursor:
echo -e '\033[?6c'
깜박이지 않는 red block cursor:
echo -e '\033[?17;0;64c'
요약과 해설
vga-softcursor.rst:1-62`<ESC>[?1;2;3c`의 첫 parameter는 크기와 software cursor flag, 두 번째는 XOR할 attribute, 세 번째는 먼저 설정할 attribute mask입니다. set과 toggle 양쪽에 같은 bit를 넣으면 해당 bit를 clear할 수 있습니다.