diff --git a/lua/mini/notify.lua b/lua/mini/notify.lua index fb53ab8c..a380081b 100644 --- a/lua/mini/notify.lua +++ b/lua/mini/notify.lua @@ -582,7 +582,7 @@ H.create_autocommands = function(config) vim.api.nvim_create_autocmd(event, { group = augroup, pattern = pattern, callback = callback, desc = desc }) end - au('TabEnter', '*', function() MiniNotify.refresh() end, 'Refresh in notifications in new tabpage') + au({ 'TabEnter', 'VimResized' }, '*', function() MiniNotify.refresh() end, 'Refresh notifications') end --stylua: ignore diff --git a/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize b/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize new file mode 100644 index 00000000..470a63b3 --- /dev/null +++ b/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize @@ -0,0 +1,23 @@ +--|---------|---------|---------|---------|---------| +01| ┌───────────────────┐ +02|~ │12:34:56 │ A very l│ +03|~ │ong notification │ +04|~ └───────────────────┘ +05|~ +06|~ +07|~ +08|~ +09|~ +10| + +--|---------|---------|---------|---------|---------| +01|00000000000000000000000000000111111111111111111111 +02|22222222222222222222222222222133333333333333333331 +03|22222222222222222222222222222133333333333333333331 +04|22222222222222222222222222222111111111111111111111 +05|22222222222222222222222222222222222222222222222222 +06|22222222222222222222222222222222222222222222222222 +07|22222222222222222222222222222222222222222222222222 +08|22222222222222222222222222222222222222222222222222 +09|22222222222222222222222222222222222222222222222222 +10|44444444444444444444444444444444444444444444444444 diff --git a/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-002 b/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-002 new file mode 100644 index 00000000..067d33fc --- /dev/null +++ b/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-002 @@ -0,0 +1,23 @@ +--|---------|---------|----- +01| ┌─────────┐ +02|~ │12:34:56 │ +03|~ ││ A very │ +04|~ │long noti│ +05|~ │fication │ +06|~ └─────────┘ +07|~ +08|~ +09|~ +10| + +--|---------|---------|----- +01|0000000000000011111111111 +02|2222222222222213333333331 +03|2222222222222213333333331 +04|2222222222222213333333331 +05|2222222222222213333333331 +06|2222222222222211111111111 +07|2222222222222222222222222 +08|2222222222222222222222222 +09|2222222222222222222222222 +10|4444444444444444444444444 diff --git a/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-003 b/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-003 new file mode 100644 index 00000000..d62d0d4d --- /dev/null +++ b/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-003 @@ -0,0 +1,33 @@ +--|---------|---------|---------|---------|---------| +01| +02|~ +03|~ +04|~ ┌───────────────────┐ +05|~ │12:34:58 │ A very l│ +06|~ │ong notification │ +07|~ └───────────────────┘ +08|~ +09|~ +10|~ +11|~ +12|~ +13|~ +14|~ +15| + +--|---------|---------|---------|---------|---------| +01|00000000000000000000000000000000000000000000000000 +02|11111111111111111111111111111111111111111111111111 +03|11111111111111111111111111111111111111111111111111 +04|11111111111111111112222222222222222222221111111111 +05|11111111111111111112333333333333333333321111111111 +06|11111111111111111112333333333333333333321111111111 +07|11111111111111111112222222222222222222221111111111 +08|11111111111111111111111111111111111111111111111111 +09|11111111111111111111111111111111111111111111111111 +10|11111111111111111111111111111111111111111111111111 +11|11111111111111111111111111111111111111111111111111 +12|11111111111111111111111111111111111111111111111111 +13|11111111111111111111111111111111111111111111111111 +14|11111111111111111111111111111111111111111111111111 +15|44444444444444444444444444444444444444444444444444 diff --git a/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-004 b/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-004 new file mode 100644 index 00000000..bc7d4419 --- /dev/null +++ b/tests/screenshots/tests-test_notify.lua---Window---fully-updates-on-vim-resize-004 @@ -0,0 +1,23 @@ +--|---------|---------|----- +01| +02|~ +03|~ ┌─────────┐ +04|~ │12:34:58 │ +05|~ ││ A very │ +06|~ │long noti│ +07|~ │fication │ +08|~ └─────────┘ +09|~ +10| + +--|---------|---------|----- +01|0000000000000000000000000 +02|1111111111111111111111111 +03|1111111112222222222211111 +04|1111111112333333333211111 +05|1111111112333333333211111 +06|1111111112333333333211111 +07|1111111112333333333211111 +08|1111111112222222222211111 +09|1111111111111111111111111 +10|4444444444444444444444444 diff --git a/tests/test_notify.lua b/tests/test_notify.lua index 5a50752a..74484d14 100644 --- a/tests/test_notify.lua +++ b/tests/test_notify.lua @@ -831,6 +831,26 @@ T['Window']['persists across tabpages'] = function() eq(is_notif_window_shown(new_tabpage_id), false) end +T['Window']['fully updates on vim resize'] = function() + -- With default window config + child.set_size(10, 50) + add('A very long notification') + child.expect_screenshot() + child.o.columns = 25 + child.expect_screenshot() + clear() + + -- With callable window config + child.set_size(15, 50) + child.lua([[MiniNotify.config.window.config = function() + return { row = math.floor(0.2 * vim.o.lines), col = math.floor(0.8 * vim.o.columns) } + end]]) + add('A very long notification') + child.expect_screenshot() + child.o.lines, child.o.columns = 10, 25 + child.expect_screenshot() +end + T['Window']['does not affect normal window navigation'] = function() local win_id_1 = child.api.nvim_get_current_win() child.cmd('botright wincmd v')