From 2d41812e239b268afd3964dadaf0273606b60c10 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 26 Sep 2024 03:40:25 +0200 Subject: [PATCH] fix: startswith direction --- lua/codemp/neo-tree/commands.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/codemp/neo-tree/commands.lua b/lua/codemp/neo-tree/commands.lua index 64cb147..ece75ea 100644 --- a/lua/codemp/neo-tree/commands.lua +++ b/lua/codemp/neo-tree/commands.lua @@ -83,7 +83,7 @@ M.move = function(state, path, extra) if selected.type == "buffer" then return vim.ui.input({ prompt = "move content into open buffer?" }, function (input) if input == nil then return end - if not vim.startswith("y", string.lower(input)) then return end + if not vim.startswith(string.lower(input), "y") then return end local window = utils.get_appropriate_window(state) local buf = vim.api.nvim_win_get_buf(window) buf_manager.attach(selected.name, buf) @@ -97,7 +97,7 @@ M.copy = function(state, path, extra) if selected.type == "buffer" then return vim.ui.input({ prompt = "copy content to remote buffer?" }, function (input) if input == nil then return end - if not vim.startswith("y", string.lower(input)) then return end + if not vim.startswith(string.lower(input), "y") then return end local window = utils.get_appropriate_window(state) local buf = vim.api.nvim_win_get_buf(window) local content = codemp_utils.buffer.get_content(buf) @@ -112,14 +112,14 @@ M.delete = function(state, path, extra) if selected.type == "root" and vim.startswith(selected.name, "#") then vim.ui.input({ prompt = "disconnect from workspace?" }, function (input) if input == nil then return end - if not vim.startswith("y", string.lower(input)) then return end + if not vim.startswith(string.lower(input), "y") then return end ws_manager.leave() end) elseif selected.type == "buffer" then if CODEMP.workspace == nil then error("join a workspace first") end vim.ui.input({ prompt = "delete buffer '" .. selected.name .. "'?" }, function (input) if input == nil then return end - if not vim.startswith("y", string.lower(input)) then return end + if not vim.startswith(string.lower(input), "y") then return end CODEMP.workspace:delete(selected.name):and_then(function () print("deleted buffer " .. selected.name) manager.refresh("codemp") @@ -129,7 +129,7 @@ M.delete = function(state, path, extra) if CODEMP.client == nil then error("connect to server first") end vim.ui.input({ prompt = "delete buffer '" .. selected.name .. "'?" }, function (input) if input == nil then return end - if not vim.startswith("y", string.lower(input)) then return end + if not vim.startswith(string.lower(input), "y") then return end CODEMP.client:delete_workspace(selected.name):and_then(function () print("deleted workspace " .. selected.name) manager.refresh("codemp")