diff --git a/toys/pending/crontab.c b/toys/pending/crontab.c index 6c1c65a29a9c50fecc1c81cafe60826290fcf9cf..559ae189a3f71a52abf95d9fb70a898c424562df 100644 --- a/toys/pending/crontab.c +++ b/toys/pending/crontab.c @@ -274,6 +274,7 @@ static void do_edit(struct passwd *pwd) if ((destfd = mkstemp(tname)) < 0) perror_exit("Can't open tmp file"); + xwrite(destfd, "", 1); fchmod(destfd, 0666); snprintf(toybuf, sizeof(toybuf), "%s%s", TT.cdir, pwd->pw_name); diff --git a/toys/pending/vi.c b/toys/pending/vi.c index d39e66eef88296cf3be0dacb1b6a5b4c5d1d383d..46447302aee311de6d33f494808b32cbe0475f26 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; @@ -907,8 +908,11 @@ void vi_main(void) while(1) { 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 + terminal_size(&TT.screen_width, &TT.screen_height); + 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;