Skip to content

Commit cb8a92c

Browse files
authored
Merge pull request #1338 from vim-jp/hh-update-windows
Update windows.{txt,jax}
2 parents f6c0141 + 9080854 commit cb8a92c

File tree

2 files changed

+104
-4
lines changed

2 files changed

+104
-4
lines changed

doc/windows.jax

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*windows.txt* For Vim バージョン 9.0. Last change: 2022 May 11
1+
*windows.txt* For Vim バージョン 9.0. Last change: 2022 Nov 27
22

33

44
VIMリファレンスマニュアル by Bram Moolenaar
@@ -196,7 +196,7 @@ CTRL-W v *CTRL-W_v*
196196
い。
197197

198198
CTRL-W n *CTRL-W_n*
199-
CTRL-W CTRL_N *CTRL-W_CTRL-N*
199+
CTRL-W CTRL-N *CTRL-W_CTRL-N*
200200
:[N]new [++opt] [+cmd] *:new*
201201
新しいウィンドウを作成して空のファイルの編集が始まる。新しい
202202
ウィンドウの高さはNになる(デフォルトの高さはカレントウィンドウ
@@ -638,6 +638,56 @@ CTRL-W | カレントウィンドウの幅を N桁にする (デフォルト:可
638638
ウィンドウの最小の高さと幅は 'winminheight''winminwidth' によって設定され
639639
る。これらは絶対的な値で、ウィンドウはこれらより小さくなることはない。
640640

641+
642+
WinScrolled と WinResized 自動コマンド ~
643+
*win-scrolled-resized*
644+
ウィンドウ サイズの変更の通知を受け取りたい場合は、|WinResized| 自動コマンドイ
645+
ベントを使用できる。
646+
垂直方向または水平方向にスクロールするウィンドウ内のテキストの通知を受け取りた
647+
い場合は、|WinScrolled| 自動コマンドイベントを使用できる。これはウィンドウサイ
648+
ズの変更でもトリガーされる。
649+
例外: テキストが 'incsearch' のためにスクロールしても、イベントはトリガーされ
650+
ない。
651+
*WinResized-event*
652+
|WinResized| イベントは表示更新後にトリガーされ、その時にいくつかのウィンドウ
653+
のサイズが変更される可能性がある。前回以降に変更されたウィンドウの ID のリスト
654+
は、v:event.windows 変数で提供される。例:
655+
[1003, 1006]
656+
*WinScrolled-event*
657+
|WinScrolled| イベントは |WinResized| の後、およびウィンドウがスクロールされた
658+
場合にもトリガーされる。これは、垂直方向 (ウィンドウ上部のテキストが変更された
659+
場合) または水平方向 ('wrap' がオフの場合、または最初の行の最初に表示される部
660+
分が変更された場合) になる。Note |WinScrolled||WinResized| よりも何回もト
661+
リガーされるため、編集が少し遅くなる可能性があることに注意。
662+
663+
|WinScrolled| によって提供される情報は、ウィンドウIDをキーとして、変更があった
664+
各ウィンドウの辞書と、"all" をキーとした変更の総カウントです。|v:event| の値の
665+
例 (|Vim9| 構文):
666+
{
667+
all: {width: 0, height: 2, leftcol: 0, skipcol: 0, topline: 1, topfill: 0},
668+
1003: {width: 0, height: -1, leftcol: 0, skipcol: 0, topline: 0, topfill: 0},
669+
1006: {width: 0, height: 1, leftcol: 0, skipcol: 0, topline: 1, topfill: 0},
670+
}
671+
672+
Note "all" エントリは、個別のウィンドウの絶対値が累積されていることに注意。
673+
674+
何が変更されたかについてさらに詳しい情報が必要な場合、またはイベントを
675+
"debounce" したい場合 (過剰な動作を避けるためにすべてのイベントを処理しない)、
676+
`winlayout()` および `getwininfo()` 関数を使用するとよい。
677+
678+
|WinScrolled| および |WinResized| は最初の自動コマンドが追加されたときはトリ
679+
ガーされず、最初のスクロールまたはサイズ変更の後にのみトリガーされる。別のタブ
680+
ページに切り替えるときにトリガーされる場合がある。
681+
682+
実行されるコマンドは、ウィンドウサイズやスクロールの変更を引き起こさないことが
683+
期待される。
684+
いずれにせよ、このようなことが起こった場合、イベントはすぐに再びトリガーされ
685+
る。言い換えると、イベントをトリガーする直前に、現在のサイズとスクロール位置が
686+
保存され、変更があったかどうかを判断するために使用される。
687+
*E1312*
688+
ここでウィンドウのレイアウトを変更する (ウィンドウを分割、閉じる、または移動す
689+
る) ことはできない。
690+
641691
==============================================================================
642692
7. コマンド引数とバッファリスト *buffer-list*
643693

en/windows.txt

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*windows.txt* For Vim version 9.0. Last change: 2022 May 11
1+
*windows.txt* For Vim version 9.0. Last change: 2022 Nov 27
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -189,7 +189,7 @@ CTRL-W v *CTRL-W_v*
189189
it doesn't!
190190

191191
CTRL-W n *CTRL-W_n*
192-
CTRL-W CTRL_N *CTRL-W_CTRL-N*
192+
CTRL-W CTRL-N *CTRL-W_CTRL-N*
193193
:[N]new [++opt] [+cmd] *:new*
194194
Create a new window and start editing an empty file in it.
195195
Make new window N high (default is to use half the existing
@@ -631,6 +631,56 @@ it).
631631
The minimal height and width of a window is set with 'winminheight' and
632632
'winminwidth'. These are hard values, a window will never become smaller.
633633

634+
635+
WinScrolled and WinResized autocommands ~
636+
*win-scrolled-resized*
637+
If you want to get notified of changes in window sizes, the |WinResized|
638+
autocommand event can be used.
639+
If you want to get notified of text in windows scrolling vertically or
640+
horizontally, the |WinScrolled| autocommand event can be used. This will also
641+
trigger in window size changes.
642+
Exception: the events will not be triggered when the text scrolls for
643+
'incsearch'.
644+
*WinResized-event*
645+
The |WinResized| event is triggered after updating the display, several
646+
windows may have changed size then. A list of the IDs of windows that changed
647+
since last time is provided in the v:event.windows variable, for example:
648+
[1003, 1006]
649+
*WinScrolled-event*
650+
The |WinScrolled| event is triggered after |WinResized|, and also if a window
651+
was scrolled. That can be vertically (the text at the top of the window
652+
changed) or horizontally (when 'wrap' is off or when the first displayed part
653+
of the first line changes). Note that |WinScrolled| will trigger many more
654+
times than |WinResized|, it may slow down editing a bit.
655+
656+
The information provided by |WinScrolled| is a dictionary for each window that
657+
has changes, using the window ID as the key, and a total count of the changes
658+
with the key "all". Example value for |v:event| (|Vim9| syntax):
659+
{
660+
all: {width: 0, height: 2, leftcol: 0, skipcol: 0, topline: 1, topfill: 0},
661+
1003: {width: 0, height: -1, leftcol: 0, skipcol: 0, topline: 0, topfill: 0},
662+
1006: {width: 0, height: 1, leftcol: 0, skipcol: 0, topline: 1, topfill: 0},
663+
}
664+
665+
Note that the "all" entry has the absolute values of the individual windows
666+
accumulated.
667+
668+
If you need more information about what changed, or you want to "debounce" the
669+
events (not handle every event to avoid doing too much work), you may want to
670+
use the `winlayout()` and `getwininfo()` functions.
671+
672+
|WinScrolled| and |WinResized| do not trigger when the first autocommand is
673+
added, only after the first scroll or resize. They may trigger when switching
674+
to another tab page.
675+
676+
The commands executed are expected to not cause window size or scroll changes.
677+
If this happens anyway, the event will trigger again very soon. In other
678+
words: Just before triggering the event, the current sizes and scroll
679+
positions are stored and used to decide whether there was a change.
680+
*E1312*
681+
It is not allowed to change the window layout here (split, close or move
682+
windows).
683+
634684
==============================================================================
635685
7. Argument and buffer list commands *buffer-list*
636686

0 commit comments

Comments
 (0)