Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ChatToggle command will create a new chat on Windows. #176

Open
ziboh opened this issue Jul 28, 2024 · 4 comments
Open

The ChatToggle command will create a new chat on Windows. #176

ziboh opened this issue Jul 28, 2024 · 4 comments
Labels
bug Something isn't working needs resolve confirmation Solution requires testing or confirmation from users

Comments

@ziboh
Copy link
Contributor

ziboh commented Jul 28, 2024

Hi, This plugin is very greet.
When I use the ChatToggle command, a new chat will be created.
I took a look at the source code and found that the file last.md was created using the ln command.
However, The file last.md has not been created. Creating a Symbolic link on Windows requires administrator privileges.
So how should I proceed with the modifications? 🙏

@Robitx
Copy link
Owner

Robitx commented Jul 31, 2024

@ziboh Thanks for the PR fix, I've just wrapped the \\ substitution so it's windows only

	if vim.fn.has("win32") then
		file_name = file_name:gsub("\\", "/")
		chat_dir = chat_dir:gsub("\\", "/")
	end

If you can confirm the latest version 3.5.1 is working fine, we can close this.

@ziboh
Copy link
Contributor Author

ziboh commented Aug 2, 2024

@Robitx Thank you for your Code Review. Some new issues have arisen now.
When I use the ChatDelete command to delete a conversation, And then use the ChatToggle command, I find that no new file is created, And the file linked to last.md is also the one that was just deleted.

If last.md does not have a valid path link, The window opened by ChatFinder command will show nothing.

@ziboh
Copy link
Contributor Author

ziboh commented Aug 2, 2024

@ziboh Thanks for the PR fix, I've just wrapped the \\ substitution so it's windows only

	if vim.fn.has("win32") then
		file_name = file_name:gsub("\\", "/")
		chat_dir = chat_dir:gsub("\\", "/")
	end

If you can confirm the latest version 3.5.1 is working fine, we can close this.

I think it would be best to directly modify the starts_with function, as I encountered a similar error when deleting sessions, and the error disappeared when I directly modified the starts_with function.

_H.starts_with = function(str, start)
	if vim.fn.has("win32") then
		str = str:gsub("\\", "/")
		start = start:gsub("\\", "/")
	end
	return str:sub(1, #start) == start
end

@Robitx
Copy link
Owner

Robitx commented Aug 4, 2024

@ziboh could you please check latest version 3.7.0 which remembers last chat in state file instead of using symlinks?

@Robitx Robitx added bug Something isn't working needs resolve confirmation Solution requires testing or confirmation from users labels Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs resolve confirmation Solution requires testing or confirmation from users
Projects
None yet
Development

No branches or pull requests

2 participants