From 3a3c6f0907445754a1d26ffc84788bbc88e038c5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 23 Mar 2026 10:14:48 -0400 Subject: [PATCH] refactor: rename termcap.lua -> tty.lua #38437 Problem: The `termcap.lua` module is too narrowly named. We may need a place for tty-related functionality in the future. https://github.com/neovim/neovim/pull/31399#discussion_r1882598297 Solution: This isn't a public/documented interface, so just rename it. --- runtime/lua/vim/_core/defaults.lua | 2 +- runtime/lua/vim/{termcap.lua => tty.lua} | 0 runtime/plugin/osc52.lua | 2 +- src/nvim/tui/tui.c | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename runtime/lua/vim/{termcap.lua => tty.lua} (100%) diff --git a/runtime/lua/vim/_core/defaults.lua b/runtime/lua/vim/_core/defaults.lua index 69c76118f2..c1e6d52366 100644 --- a/runtime/lua/vim/_core/defaults.lua +++ b/runtime/lua/vim/_core/defaults.lua @@ -1004,7 +1004,7 @@ do -- Neither the TUI nor $COLORTERM indicate that truecolor is supported, so query the -- terminal local caps = {} ---@type table - require('vim.termcap').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found) + require('vim.tty').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found) if not found then return end diff --git a/runtime/lua/vim/termcap.lua b/runtime/lua/vim/tty.lua similarity index 100% rename from runtime/lua/vim/termcap.lua rename to runtime/lua/vim/tty.lua diff --git a/runtime/plugin/osc52.lua b/runtime/plugin/osc52.lua index a17ce14f5a..deeda7ad31 100644 --- a/runtime/plugin/osc52.lua +++ b/runtime/plugin/osc52.lua @@ -60,7 +60,7 @@ vim.api.nvim_create_autocmd('UIEnter', { end -- Fallback to XTGETTCAP - require('vim.termcap').query('Ms', function(cap, found, seq) + require('vim.tty').query('Ms', function(cap, found, seq) if not found then return end diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index 0febdb4dcd..a257827f82 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -2012,7 +2012,7 @@ static void terminfo_set_str(TUIData *tui, TerminfoDef str, const char *val) /// Determine if the terminal supports truecolor or not. /// /// note: We get another chance at detecting these in the nvim server process, see -/// the use of vim.termcap in runtime/lua/vim/_core/defaults.lua +/// the use of vim.tty in runtime/lua/vim/_core/defaults.lua /// /// If terminfo contains Tc, RGB, or both setrgbf and setrgbb capabilities, return true. static bool term_has_truecolor(TUIData *tui, const char *colorterm)