aboutsummaryrefslogtreecommitdiff
path: root/lua/encrypt/encrypt.lua
diff options
context:
space:
mode:
authorkongjun <kongjun18@outlook.com>2025-05-06 10:14:39 +0000
committerkongjun <kongjun18@outlook.com>2025-05-06 18:53:58 +0800
commita9e7d700eb546800e3d341bc53667964ac821a38 (patch)
treebf21093fa70c8ed8014e70f4841714d622ec651e /lua/encrypt/encrypt.lua
parentc7a16c626a0379d9304e0337348affb4bde9ba4e (diff)
downloadencrypt.nvim-a9e7d700eb546800e3d341bc53667964ac821a38.tar.gz
feat: handle the case where the inputsecret() is cancelled
Diffstat (limited to 'lua/encrypt/encrypt.lua')
-rw-r--r--lua/encrypt/encrypt.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/lua/encrypt/encrypt.lua b/lua/encrypt/encrypt.lua
index 93d2b78..c7efb1f 100644
--- a/lua/encrypt/encrypt.lua
+++ b/lua/encrypt/encrypt.lua
@@ -12,6 +12,10 @@ end
local function encrypt()
local password = helpers.getPassword()
+ if not password then
+ vim.notify("Password can not be empty", vim.log.levels.ERROR)
+ return
+ end
local buf_lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
local encrypted_lines = encrypt_lines(buf_lines, password)