diff --git a/Makefile b/Makefile index 03374226..7b37ca88 100644 --- a/Makefile +++ b/Makefile @@ -7,25 +7,20 @@ TIMEOUT_MINS := $(shell echo $$((30 * 60 * 1000))) .PHONY: test-sequential .PHONY: test-all .PHONY: test-all-sequential -.PHONY: test-demo -.PHONY: test-demo-main -.PHONY: test-demo-config -.PHONY: record-demo -.PHONY: record-demo-main test: @nvim \ --headless \ --noplugin \ -u ${TESTS_INIT} \ - -c "lua require([[plenary.test_harness]]).test_directory([[tests ! -regex .*_demo.*_spec.*]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", })" + -c "lua require([[plenary.test_harness]]).test_directory([[tests ! -regex .*_config.*_spec.*]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", })" test-sequential: @nvim \ --headless \ --noplugin \ -u ${TESTS_INIT} \ - -c "lua require([[plenary.test_harness]]).test_directory([[tests ! -regex .*_demo.*_spec.*]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", sequential = true, })" + -c "lua require([[plenary.test_harness]]).test_directory([[tests ! -regex .*_config.*_spec.*]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", sequential = true, })" test-all: @nvim \ @@ -41,37 +36,3 @@ test-all-sequential: -u ${TESTS_INIT} \ -c "lua require([[plenary.test_harness]]).test_directory([[tests]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", sequential = true, })" -test-demo: - @nvim \ - --headless \ - --noplugin \ - -u ${TESTS_INIT} \ - -c "lua require([[plenary.test_harness]]).test_directory([[tests -regex .*_demo.*_spec.*]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", })" - -test-demo-main: - @nvim \ - --headless \ - --noplugin \ - -u ${TESTS_INIT} \ - -c "lua require([[plenary.test_harness]]).test_directory([[tests -name kitty_scrollback_demo_spec.lua]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", })" - -test-demo-config: - @nvim \ - --headless \ - --noplugin \ - -u ${TESTS_INIT} \ - -c "lua require([[plenary.test_harness]]).test_directory([[tests -regex .*kitty_scrollback_config_demo.*_spec.lua]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", })" - -record-demo: - @nvim \ - --headless \ - --noplugin \ - -u ${TESTS_INIT} \ - -c "lua vim.env.KSB_RECORD_DEMO = 'true' require([[plenary.test_harness]]).test_directory([[tests -regex .*_demo.*_spec.*]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", sequential = true, })" - -record-demo-main: - @nvim \ - --headless \ - --noplugin \ - -u ${TESTS_INIT} \ - -c "lua vim.env.KSB_RECORD_DEMO = 'true' require([[plenary.test_harness]]).test_directory([[tests -name kitty_scrollback_demo_spec.lua]], { minimal_init = '"${TESTS_INIT}"', timeout = "${TIMEOUT_MINS}", sequential = true, })" diff --git a/README.md b/README.md index 627e46c0..33f86092 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ Navigate your [Kitty](https://sw.kovidgoyal.net/kitty/) scrollback buffer to qui kitty-scrollback.nvim demo -
(click for video)
@@ -67,7 +66,7 @@ Navigate your [Kitty](https://sw.kovidgoyal.net/kitty/) scrollback buffer to qui > Expand each section under the [Features](#-features) section to see a demo. > > Check out the [wiki](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki) for -> [detailed demos of each configuration option](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki/Advanced-Configuration-Examples), [useful configurations](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki#useful-configurations), and more. +> [useful](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki#useful-configurations) and [recommended](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki#recommended-configurations-for-other-plugins) configurations. @@ -373,8 +372,6 @@ This section provides details on how to customize your kitty-scrollback.nvim con > Please review the [Recommended Configurations for other plugins](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki#recommended-configurations-for-other-plugins) > section of the wiki to prevent conflicts with other plugins. > -> The [Advanced Configuration](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki#advanced-configuration) section of the wiki provides -> [useful configurations](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki#useful-configurations) and [detailed demos of each configuration option](https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki/Advanced-Configuration-Examples). ### Kitten Arguments Arguments that can be passed to the `kitty_scrollback_nvim` [Kitten](https://sw.kovidgoyal.net/kitty/kittens_intro/) defined in [kitty.conf](https://sw.kovidgoyal.net/kitty/conf/). You can provide diff --git a/tests/kitty-scrollback/helpers.lua b/tests/kitty-scrollback/helpers.lua index f1e5ab5f..d77a1d4a 100644 --- a/tests/kitty-scrollback/helpers.lua +++ b/tests/kitty-scrollback/helpers.lua @@ -726,7 +726,10 @@ M.ksb_dir = function() end M.init_nvim = function(config_override) - local config_dir = vim.fn.fnamemodify(vim.fn.fnamemodify(vim.fn.stdpath('config'), ':h'), ':p') + --- @type string + --- @diagnostic disable-next-line:assign-type-mismatch + local config_path = vim.fn.stdpath('config') + local config_dir = vim.fn.fnamemodify(vim.fn.fnamemodify(config_path, ':h'), ':p') local nvim_config_dir = config_dir .. 'ksb-nvim-tests' local is_directory = vim.fn.isdirectory(nvim_config_dir) > 0 if is_directory then diff --git a/tests/kitty-scrollback/kitty_scrollback_config_demo_01_spec.lua b/tests/kitty-scrollback/kitty_scrollback_config_01_spec.lua similarity index 99% rename from tests/kitty-scrollback/kitty_scrollback_config_demo_01_spec.lua rename to tests/kitty-scrollback/kitty_scrollback_config_01_spec.lua index 7a1926f6..d60c7089 100644 --- a/tests/kitty-scrollback/kitty_scrollback_config_demo_01_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_config_01_spec.lua @@ -1,6 +1,4 @@ local h = require('tests.kitty-scrollback.helpers') -local screencapture = require('tests.kitty-scrollback.screencapture') - h.setup_backport() local ksb_dir = h.ksb_dir() @@ -14,7 +12,7 @@ local tmpsock = h.tempsocket(ksb_dir .. 'tmp/') local kitty_instance local ksb_work_dir -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') local kitty_cmd = h.debug({ h.kitty, @@ -81,8 +79,6 @@ local function after_all() vim.fn.delete(ksb_work_dir, 'rf') end -local it = screencapture.wrap_it(it, tmpsock, 0) - describe('kitty-scrollback.nvim', function() before_all() diff --git a/tests/kitty-scrollback/kitty_scrollback_config_demo_02_spec.lua b/tests/kitty-scrollback/kitty_scrollback_config_02_spec.lua similarity index 99% rename from tests/kitty-scrollback/kitty_scrollback_config_demo_02_spec.lua rename to tests/kitty-scrollback/kitty_scrollback_config_02_spec.lua index 8c028ff4..9c483ec5 100644 --- a/tests/kitty-scrollback/kitty_scrollback_config_demo_02_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_config_02_spec.lua @@ -1,6 +1,4 @@ local h = require('tests.kitty-scrollback.helpers') -local screencapture = require('tests.kitty-scrollback.screencapture') - h.setup_backport() local ksb_dir = h.ksb_dir() @@ -13,7 +11,7 @@ local tmpsock = h.tempsocket(ksb_dir .. 'tmp/') local kitty_instance local ksb_work_dir -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') local kitty_cmd = h.debug({ h.kitty, @@ -80,8 +78,6 @@ local function after_all() vim.fn.delete(ksb_work_dir, 'rf') end -local it = screencapture.wrap_it(it, tmpsock, 11) - -- TODO: seeing some flakiness in github runners, adding a delay to see if this helps -- we may want to add conditional delays depending on if the test is running locally vs a github runner local append_delay = 3 diff --git a/tests/kitty-scrollback/kitty_scrollback_config_demo_03_spec.lua b/tests/kitty-scrollback/kitty_scrollback_config_03_spec.lua similarity index 99% rename from tests/kitty-scrollback/kitty_scrollback_config_demo_03_spec.lua rename to tests/kitty-scrollback/kitty_scrollback_config_03_spec.lua index 03579d86..13dbd000 100644 --- a/tests/kitty-scrollback/kitty_scrollback_config_demo_03_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_config_03_spec.lua @@ -1,6 +1,4 @@ local h = require('tests.kitty-scrollback.helpers') -local screencapture = require('tests.kitty-scrollback.screencapture') - h.setup_backport() local ksb_dir = h.ksb_dir() @@ -13,7 +11,7 @@ local tmpsock = h.tempsocket(ksb_dir .. 'tmp/') local kitty_instance local ksb_work_dir -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') local kitty_cmd = h.debug({ h.kitty, @@ -80,8 +78,6 @@ local function after_all() vim.fn.delete(ksb_work_dir, 'rf') end -local it = screencapture.wrap_it(it, tmpsock, 20) - describe('kitty-scrollback.nvim', function() before_all() diff --git a/tests/kitty-scrollback/kitty_scrollback_config_demo_04_spec.lua b/tests/kitty-scrollback/kitty_scrollback_config_04_spec.lua similarity index 99% rename from tests/kitty-scrollback/kitty_scrollback_config_demo_04_spec.lua rename to tests/kitty-scrollback/kitty_scrollback_config_04_spec.lua index f5696b54..f17feed8 100644 --- a/tests/kitty-scrollback/kitty_scrollback_config_demo_04_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_config_04_spec.lua @@ -1,6 +1,4 @@ local h = require('tests.kitty-scrollback.helpers') -local screencapture = require('tests.kitty-scrollback.screencapture') - h.setup_backport() local ksb_dir = h.ksb_dir() @@ -13,7 +11,7 @@ local tmpsock = h.tempsocket(ksb_dir .. 'tmp/') local kitty_instance local ksb_work_dir -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') local kitty_cmd = h.debug({ h.kitty, @@ -80,8 +78,6 @@ local function after_all() vim.fn.delete(ksb_work_dir, 'rf') end -local it = screencapture.wrap_it(it, tmpsock, 27) - describe('kitty-scrollback.nvim', function() before_all() diff --git a/tests/kitty-scrollback/kitty_scrollback_cursor_position_spec.lua b/tests/kitty-scrollback/kitty_scrollback_cursor_position_spec.lua index 266f1089..32c1084c 100644 --- a/tests/kitty-scrollback/kitty_scrollback_cursor_position_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_cursor_position_spec.lua @@ -11,7 +11,7 @@ h.debug({ local tmpsock local kitty_instance -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') describe('kitty-scrollback.nvim', function() h.init_nvim() diff --git a/tests/kitty-scrollback/kitty_scrollback_demo_spec.lua b/tests/kitty-scrollback/kitty_scrollback_demo_spec.lua deleted file mode 100644 index 8d2c18b1..00000000 --- a/tests/kitty-scrollback/kitty_scrollback_demo_spec.lua +++ /dev/null @@ -1,398 +0,0 @@ -local h = require('tests.kitty-scrollback.helpers') -local screencapture = require('tests.kitty-scrollback.screencapture') - -h.setup_backport() - -local ksb_dir = h.ksb_dir() -h.debug({ - ksb_dir = ksb_dir, - kitty_conf = ksb_dir .. 'tests/kitty.conf', -}) - -local tmpsock -local kitty_instance -local ksb_work_dir - -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) - -local it = screencapture.wrap_it(it, function() - return tmpsock -end) - -describe('kitty-scrollback.nvim', function() - h.init_nvim() - - before_each(function() - vim.fn.mkdir(ksb_dir .. 'tests/workdir', 'p') - tmpsock = h.tempsocket(ksb_dir .. 'tmp/') - local kitty_cmd = h.debug({ - h.kitty, - '--listen-on=unix:' .. tmpsock, - '--config', - ksb_dir .. 'tests/kitty.conf', - '--override', - 'shell=' .. shell, - '--override', - 'enabled_layouts=fat:bias=90', - '--override', - 'initial_window_width=161c', - '--override', - 'initial_window_height=30c', - '--override', - 'font_size=18.0', - '--override', - 'background_opacity=1.0', - '--session', - '-', -- read session from stdin - }) - kitty_instance = h.wait_for_kitty_remote_connection(kitty_cmd, tmpsock, { - stdin = 'cd ' .. ksb_dir, - }) - ksb_work_dir = os.getenv('KITTY_SCROLLBACK_NVIM_DIR') or 'tmp/00_kitty-scrollback.nvim' - local is_directory = vim.fn.isdirectory(ksb_work_dir) > 0 - if is_directory then - vim.fn.delete(ksb_work_dir, 'rf') - end - vim - .system({ - 'git', - 'clone', - 'https://github.com/mikesmithgh/kitty-scrollback.nvim', - ksb_work_dir, - }) - :wait() - - h.feed_kitty({ - h.send_as_string([[source ]] .. ksb_dir .. [[tests/bashrc]]), - h.send_as_string([[cd ]] .. ksb_work_dir), - h.send_as_string([[git checkout main]]), - h.with_pause_seconds_before( - h.send_as_string([[ -echo '-- demo' >> README.md -echo '-- demo' >> lua/kitty-scrollback/init.lua -echo '-- demo' >> lua/kitty-scrollback/api.lua -echo '-- demo' >> lua/kitty-scrollback/health.lua]]), - 3 - ), - h.with_pause_seconds_before(h.send_without_newline(h.clear())), - }) - end) - - after_each(function() - kitty_instance:kill(2) - kitty_instance = nil - vim.fn.delete(vim.fn.fnamemodify(tmpsock, ':p:h'), 'rf') - vim.fn.delete(ksb_work_dir, 'rf') - end) - - it('kitty_scrollback_nvim', function() - h.assert_screen_equals( - h.feed_kitty({ - [[git status]], - h.with_pause_seconds_before(h.open_kitty_scrollback_nvim()), - h.with_pause_seconds_before([[?README.md]]), - h.send_without_newline(h.control_v()), - h.send_without_newline([[jjj$]]), - h.with_pause_seconds_before(h.send_without_newline([[yddggI]]), 1), - h.send_without_newline([[git checkout ]]), - h.send_without_newline(h.esc()), - h.send_without_newline([[j0]]), - h.send_without_newline(h.control_v()), - h.send_without_newline([[G]]), - h.with_pause_seconds_before(h.send_without_newline([[Igit add ]]), 1), - h.send_without_newline(h.esc()), - h.send_without_newline(h.control_enter()), - h.with_pause_seconds_before([[git status]], 1), - h.open_kitty_scrollback_nvim(), - h.with_pause_seconds_before(h.send_without_newline([[4k3V]])), - h.with_pause_seconds_before(h.send_without_newline([[yggO]]), 1), - [[printf "\\033[0m\\033[38;2;167;192;128m"]], - h.send_without_newline([[cat <..." to update what will be committed) - (use "git restore ..." to discard changes in working directory) - modified: README.md - modified: lua/kitty-scrollback/api.lua - modified: lua/kitty-scrollback/health.lua - modified: lua/kitty-scrollback/init.lua - -no changes added to commit (use "git add" and/or "git commit -a") -$ git checkout README.md -git add lua/kitty-scrollback/api.lua -git add lua/kitty-scrollback/health.lua -git add lua/kitty-scrollback/init.lua -Updated 1 path from the index -$ git status -On branch main -Your branch is up to date with 'origin/main'. - -Changes to be committed: - (use "git restore --staged ..." to unstage) - modified: lua/kitty-scrollback/api.lua - modified: lua/kitty-scrollback/health.lua - modified: lua/kitty-scrollback/init.lua - -$ printf "\033[0m\033[38;2;167;192;128m" -cat < EOF - modified: lua/kitty-scrollback/api.lua - modified: lua/kitty-scrollback/health.lua - modified: lua/kitty-scrollback/init.lua -$ loldino - ______ -( nice ) - ------ -o . . - o / `. .' " - o .---. < > < > .---. - o | \ \ - ~ ~ - / / | - _____ ..-~ ~-..-~ - | | \~~~\.' `./~~~/ - --------- \__/ \__/ - .' O \ / / \ " - (_____, `._.' | } \/~~~/ - `----. / } | / \__/ - `-. | / | / `. ,~~| - ~-.__| /_ - ~ ^| /- _ `..-' - | / | / ~-. `-. _ _ _ - |_____| |_____| ~ - . _ _ _ _ _> -$ -]], - cursor_y = 30, - cursor_x = 3, - } - ) - end) - - it('should_copy_visual_selection_to_clipboard', function() - local paste = function() - return vim.fn.getreg('+') - end - h.feed_kitty({ - [[git status]], - h.open_kitty_scrollback_nvim(), - h.with_pause_seconds_before([[?README.md]]), - h.send_without_newline([[viW]]), - h.with_pause_seconds_before(h.send_without_newline([[\y]]), 1), - }, 0) - h.assert_screen_equals( - h.feed_kitty({ - h.with_pause_seconds_before( - h.send_without_newline([[printf "\n kitty-scrollback.nvim copied \e[35m]]) - ), - h.with_pause_seconds_before(h.send_without_newline(h.send_as_string(paste())), 1), - h.with_pause_seconds_before([[\e[0m to clipboard\n\n"]], 1), - }), - { - stdout = [[ -$ git status -On branch main -Your branch is up to date with 'origin/main'. - -Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git restore ..." to discard changes in working directory) - modified: README.md - modified: lua/kitty-scrollback/api.lua - modified: lua/kitty-scrollback/health.lua - modified: lua/kitty-scrollback/init.lua - -no changes added to commit (use "git add" and/or "git commit -a") -$ printf "\n kitty-scrollback.nvim copied \e[35mREADME.md\e[0m to clipboard\n\n" - - kitty-scrollback.nvim copied README.md to clipboard - -$ -]], - cursor_y = 18, - cursor_x = 3, - } - ) - end) - - it('should_paste_paste_window_text_to_kitty', function() - h.assert_screen_equals( - h.feed_kitty({ - [[git status]], - h.with_pause_seconds_before( - h.send_without_newline([[printf "\n kitty-scrollback.nvim pasted \e[35m]]) - ), - h.open_kitty_scrollback_nvim(), - h.with_pause_seconds_before([[?README.md]], 2), - h.send_without_newline([[viW]]), - h.with_pause_seconds_before(h.send_without_newline([[y]]), 1), - h.with_pause_seconds_before(h.send_without_newline([[ggA\\e[0m to kitty\\n\\n"]]), 1), - h.with_pause_seconds_before(h.shift_enter(), 1), - }), - { - stdout = [[ -$ git status -On branch main -Your branch is up to date with 'origin/main'. - -Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git restore ..." to discard changes in working directory) - modified: README.md - modified: lua/kitty-scrollback/api.lua - modified: lua/kitty-scrollback/health.lua - modified: lua/kitty-scrollback/init.lua - -no changes added to commit (use "git add" and/or "git commit -a") -$ printf "\n kitty-scrollback.nvim pasted \e[35mREADME.md\e[0m to kitty\n\n" - - kitty-scrollback.nvim pasted README.md to kitty - -$ -]], - cursor_y = 18, - cursor_x = 3, - } - ) - end) - - it('should_paste_visual_selection_to_kitty', function() - h.assert_screen_equals( - h.feed_kitty({ - [[git status]], - h.with_pause_seconds_before( - h.send_without_newline([[printf "\n kitty-scrollback.nvim pasted \e[35m]]) - ), - h.open_kitty_scrollback_nvim(), - h.with_pause_seconds_before([[?README.md]], 2), - h.send_without_newline([[viW]]), - h.with_pause_seconds_before(h.send_without_newline(h.shift_enter()), 1), - h.with_pause_seconds_before([[\e[0m to kitty\n\n"]], 1), - }), - { - stdout = [[ -$ git status -On branch main -Your branch is up to date with 'origin/main'. - -Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git restore ..." to discard changes in working directory) - modified: README.md - modified: lua/kitty-scrollback/api.lua - modified: lua/kitty-scrollback/health.lua - modified: lua/kitty-scrollback/init.lua - -no changes added to commit (use "git add" and/or "git commit -a") -$ printf "\n kitty-scrollback.nvim pasted \e[35mREADME.md\e[0m to kitty\n\n" - - kitty-scrollback.nvim pasted README.md to kitty - -$ -]], - cursor_y = 18, - cursor_x = 3, - } - ) - end) - - it('should_execute_paste_window_text_in_kitty', function() - h.assert_screen_equals( - h.feed_kitty({ - [[git status]], - h.open_kitty_scrollback_nvim(), - h.with_pause_seconds_before([[?README.md]], 2), - h.send_without_newline([[viW]]), - h.with_pause_seconds_before(h.send_without_newline([[y]]), 1), - h.with_pause_seconds_before( - h.send_without_newline([[ggIprintf "\\n kitty-scrollback.nvim pasted \\e[35m]]), - 1 - ), - h.send_without_newline(h.esc()), - h.with_pause_seconds_before( - h.send_without_newline([[A\\e[0m to kitty and executed the command\\n\\n"]]), - 1 - ), - h.with_pause_seconds_before(h.send_without_newline(h.control_enter()), 1), - }), - { - stdout = [[ -$ git status -On branch main -Your branch is up to date with 'origin/main'. - -Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git restore ..." to discard changes in working directory) - modified: README.md - modified: lua/kitty-scrollback/api.lua - modified: lua/kitty-scrollback/health.lua - modified: lua/kitty-scrollback/init.lua - -no changes added to commit (use "git add" and/or "git commit -a") -$ printf "\n kitty-scrollback.nvim pasted \e[35mREADME.md\e[0m to kitty and executed the command\n\n" - - kitty-scrollback.nvim pasted README.md to kitty and executed the command - -$ -]], - cursor_y = 18, - cursor_x = 3, - } - ) - end) - - it('should_execute_visual_selection_in_kitty', function() - h.assert_screen_equals( - h.feed_kitty({ - [[git status]], - h.with_pause_seconds_before( - h.send_without_newline( - [[echo -e \\nkitty-scrollback.nvim executed the command and pasted \\e[35m]] - ) - ), - h.open_kitty_scrollback_nvim(), - h.with_pause_seconds_before([[?README.md]], 2), - h.send_without_newline([[viW]]), - h.with_pause_seconds_before(h.send_without_newline(h.control_enter()), 1), - }), - { - stdout = [[ -$ git status -On branch main -Your branch is up to date with 'origin/main'. - -Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git restore ..." to discard changes in working directory) - modified: README.md - modified: lua/kitty-scrollback/api.lua - modified: lua/kitty-scrollback/health.lua - modified: lua/kitty-scrollback/init.lua - -no changes added to commit (use "git add" and/or "git commit -a") -$ echo -e \\nkitty-scrollback.nvim executed the command and pasted \\e[35mREADME.md - -kitty-scrollback.nvim executed the command and pasted README.md -$ -]], - cursor_y = 17, - cursor_x = 3, - } - ) - end) -end) diff --git a/tests/kitty-scrollback/kitty_scrollback_line_offset_spec.lua b/tests/kitty-scrollback/kitty_scrollback_line_offset_spec.lua index 91016428..52548827 100644 --- a/tests/kitty-scrollback/kitty_scrollback_line_offset_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_line_offset_spec.lua @@ -11,7 +11,7 @@ h.debug({ local tmpsock local kitty_instance -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') describe('kitty-scrollback.nvim', function() h.init_nvim() diff --git a/tests/kitty-scrollback/kitty_scrollback_linux_ci_spec.lua b/tests/kitty-scrollback/kitty_scrollback_linux_ci_spec.lua index 1a499aba..e9d12e20 100644 --- a/tests/kitty-scrollback/kitty_scrollback_linux_ci_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_linux_ci_spec.lua @@ -11,7 +11,7 @@ h.debug({ local tmpsock local kitty_instance -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') local it = it if not (h.is_github_action and vim.fn.has('linux') ~= 0) then diff --git a/tests/kitty-scrollback/kitty_scrollback_spec.lua b/tests/kitty-scrollback/kitty_scrollback_spec.lua index 7c8eab0a..49ceda82 100644 --- a/tests/kitty-scrollback/kitty_scrollback_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_spec.lua @@ -11,7 +11,7 @@ h.debug({ local tmpsock local kitty_instance -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') describe('kitty-scrollback.nvim', function() h.init_nvim([[ diff --git a/tests/kitty-scrollback/kitty_scrollback_tmux_spec.lua b/tests/kitty-scrollback/kitty_scrollback_tmux_spec.lua index 18a9694e..1f277adf 100644 --- a/tests/kitty-scrollback/kitty_scrollback_tmux_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_tmux_spec.lua @@ -12,7 +12,7 @@ local tmpsock local tmux_tmpsock local kitty_instance -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') describe('kitty-scrollback.nvim', function() h.init_nvim() diff --git a/tests/kitty-scrollback/kitty_scrollback_visual_cmd_spec.lua b/tests/kitty-scrollback/kitty_scrollback_visual_cmd_spec.lua index bc0dca4e..5d000f00 100644 --- a/tests/kitty-scrollback/kitty_scrollback_visual_cmd_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_visual_cmd_spec.lua @@ -11,7 +11,7 @@ h.debug({ local tmpsock local kitty_instance -local shell = h.debug(h.is_github_action and '/bin/bash' or (vim.o.shell .. ' --noprofile --norc')) +local shell = h.debug(h.is_github_action and '/bin/bash' or 'bash --noprofile --norc') describe('kitty-scrollback.nvim', function() h.init_nvim() diff --git a/tests/kitty-scrollback/screencapture.lua b/tests/kitty-scrollback/screencapture.lua deleted file mode 100644 index 1901ceb0..00000000 --- a/tests/kitty-scrollback/screencapture.lua +++ /dev/null @@ -1,85 +0,0 @@ -local h = require('tests.kitty-scrollback.helpers') - -local M = { - screencapture_count = -1, - record_enabled = vim.env.KSB_RECORD_DEMO == 'true', - screencapture_jobid = nil, -} - -M.wrap_it = function(it, tmpsock, start) - if start then - M.screencapture_count = start - end - return function(description, fn) - it(description, function() - M.with_socket(tmpsock) - M.start(description) - fn() - M.stop() - end) - end -end - -M.with_socket = function(socket) - if not M.record_enabled then - return - end - M.tmpsock = type(socket) == 'function' and socket() or socket - local kitty_win_pid = - vim.system({ 'pgrep', '-f', 'listen-on=unix:' .. M.tmpsock }):wait().stdout:gsub('\n', '') - local pdubs_stdout = vim.system({ 'pdubs', kitty_win_pid }):wait().stdout - ---@diagnostic disable-next-line: param-type-mismatch - M.window_info = vim.json.decode(pdubs_stdout)[1].kCGWindowBounds -end - -M.start_at = function(start) - M.screencapture_count = start -end - -M.start = function(name) - if not M.record_enabled then - return - end - M.screencapture_count = M.screencapture_count + 1 - - local fname = '../kitty-scrollback.nvim.wiki/assets/kitty_scrollback_screencapture_' - .. string.format('%02d', M.screencapture_count) - .. '_' - .. name - .. '.mov' - print('Recording screencapture to ' .. vim.fn.fnamemodify(fname, ':p')) - - local screencapture_cmd = { - 'screencapture', - '-R' - .. M.window_info.X - .. ',' - .. M.window_info.Y - .. ',' - .. M.window_info.Width - .. ',' - .. M.window_info.Height, - '-x', - '-o', - '-v', - fname, - } - vim.fn.delete(fname) - M.screencapture_jobid = vim.fn.jobstart(screencapture_cmd) - h.pause_seconds(1.5) -end - -M.stop = function() - if not M.record_enabled then - return - end - if M.screencapture_jobid then - h.pause_seconds() - ---@diagnostic disable-next-line: param-type-mismatch - vim.uv.kill(vim.fn.jobpid(M.screencapture_jobid), 'sigint') - M.screencapture_jobid = nil - h.pause_seconds() - end -end - -return M