From 2ab7da2b84cab32f88808e8a05aa440e30e04899 Mon Sep 17 00:00:00 2001 From: Thang Do Date: Fri, 6 Jun 2025 11:52:28 +0700 Subject: [PATCH] fix: expand alternate filepath and trim --- lua/aoc/config.lua | 3 ++- lua/aoc/utils.lua | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/aoc/config.lua b/lua/aoc/config.lua index 6f48d7e..2716a32 100644 --- a/lua/aoc/config.lua +++ b/lua/aoc/config.lua @@ -19,7 +19,8 @@ M.init = function(args) M.options.session_filepath = vim.fn.expand(M.options.session_filepath) if M.options.puzzle_input.alternative_filepath then - M.options.alternative_filepath = vim.fn.expand(M.options.alternative_filepath) + M.options.puzzle_input.alternative_filepath = + vim.fn.expand(M.options.puzzle_input.alternative_filepath) end end diff --git a/lua/aoc/utils.lua b/lua/aoc/utils.lua index af9c5a0..530ab61 100644 --- a/lua/aoc/utils.lua +++ b/lua/aoc/utils.lua @@ -5,8 +5,8 @@ local M = {} ---@param s string ---@return string M.trim = function(s) - s, _ = string.gsub(s, "%s+", "") - return s + local result, _ = string.gsub(s, "^%s*(.-)%s*$", "%1") + return result end --- Create a simple popup message, positioned in the bottom right corner of the buffer