From 7589336120a258cf75134a5243b2f6b1926ac85b Mon Sep 17 00:00:00 2001 From: Daniel Steinberg Date: Mon, 15 Jan 2024 11:12:07 -0500 Subject: feat(terminal): respond to OSC background and foreground request (#17197) The motivation for this update is Issue #15365, where background=light is not properly set for Nvim running from an Nvim :terminal. This can be encountered when e.g., opening a terminal to make git commits, which opens EDITOR=nvim in the nested terminal. Under the implementation of this commit, the OSC response always indicates a black or white foreground/background. While this may not reflect the actual foreground/background color, it permits 'background' to be retained for a nested Nvim instance running in the terminal emulator. The behaviour matches Vim. --- test/functional/core/startup_spec.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'test/functional/core') diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index fd3748a985..f4a9c0c8d7 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -1369,12 +1369,19 @@ describe('inccommand on ex mode', function() local screen screen = Screen.new(60, 10) screen:attach() - local id = fn.termopen( - { nvim_prog, '-u', 'NONE', '-c', 'set termguicolors', '-E', 'test/README.md' }, - { - env = { VIMRUNTIME = os.getenv('VIMRUNTIME') }, - } - ) + local id = fn.termopen({ + nvim_prog, + '-u', + 'NONE', + '-i', + 'NONE', + '-c', + 'set termguicolors background=dark', + '-E', + 'test/README.md', + }, { + env = { VIMRUNTIME = os.getenv('VIMRUNTIME') }, + }) fn.chansend(id, '%s/N') screen:expect { grid = [[ -- cgit