From b2370c3c0aac6ec88a757e7bb5e28aa784b1a1d9 Mon Sep 17 00:00:00 2001 From: liutingsong <1528994254@qq.com> Date: Tue, 30 Nov 2021 20:31:49 -0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E5=BC=80=E6=94=BEvi=20=E5=91=BD=E4=BB=A4=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8vi=E6=89=93=E5=BC=80=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=87=BA=E7=8E=B0=E9=9A=8F=E6=84=8F=E6=8C=89=E9=94=AE?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E8=87=AA=E5=8A=A8=E5=88=A0=E8=A1=8C=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutingsong <1528994254@qq.com> --- toys/pending/vi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/toys/pending/vi.c b/toys/pending/vi.c index d39e66e..afedc8f 100644 --- a/toys/pending/vi.c +++ b/toys/pending/vi.c @@ -877,6 +877,7 @@ void vi_main(void) int utf8_dec_p = 0; char vi_buf[16]; int vi_buf_pos = 0; + int visual_flag = 0; il = xzalloc(sizeof(struct str_line)); il->str_data = xzalloc(80); il->alloc_len = 80; @@ -908,7 +909,10 @@ void vi_main(void) int key = scan_key(keybuf, -1); terminal_size(&TT.screen_width, &TT.screen_height); - TT.screen_height -= 2; //TODO this is hack fix visual alignment + if (visual_flag == 0) { + TT.screen_height -= 2; + visual_flag++; + } // TODO: support cursor keys in ex mode too. if (TT.vi_mode && key>=256) { key -= 256; -- Gitee