Closed perrin4869 closed 4 months ago
Hasn't happened in a while
Thanks for reporting @perrin4869!
sorry, still happening π
I'll take a look this week and see if I can replicate.
One other thing that I noticed is, sometimes immediately after running select_expand
a few times, if I press a command such as d
to delete the selected text, or =
to indent it, instead of running the command, it will be replaced by the pressed key (it's as if I'd pressed sd
in the first case, or s=
in the second).
Interesting, would you be able to test if this happens with other plugins disabled, just to rule that out?
Sure, I really should try to figure out how to reproduce it ^^;;
It's been happening in some Kotlin files, just can't reproduce it right now for some reason again π
btw, the issue I described above, if before the command I press V
, then the command, it would work as expected...
Does it ever happen when growing the selection only once, or always after multiple calls? It might be some sort of race condition where the visual mode isnβt properly triggered.
On Wed, Oct 4, 2023 at 10:37 AM Julian Grinblat @.***> wrote:
Sure, I really should try to figure out how to reproduce it ^^;; It's been happening in some Kotlin files, just can't reproduce it right now for some reason again π btw, the issue I described above, if before the command I press V, then the command, it would work as expected...
β Reply to this email directly, view it on GitHub https://github.com/Dkendal/nvim-treeclimber/issues/7#issuecomment-1746986925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYEBO6PZZOOWBPEIA7T25TX5VYDXAVCNFSM6AAAAAA3RH6RSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBWHE4DMOJSGU . You are receiving this because you commented.Message ID: @.***>
Always on the second call
ok, I managed to reproduce!!
take this file, foo.kt
:
package com.nvim.treehopper.reproduction
class MyClass {
class Fixture {
data class Fixture() {
fun execute(parameters: Map<String, String>, status: HttpResponseStatus = HttpResponseStatus.SEE_OTHER) {}
}
}
}
If you put your cursor, say, anywhere on execute
(actually, anywhere on the line seems to work), then hit <S-v><M-k><M-k><M-k>
, the file will change to:
package com.nvim.treehopper.reproduction
class MyClass {
class Fixture {
data class fixture() {
gk
}
}
}
Sorry for the contrived example, but it's not easy to reproduce ^^;; Sorry, it's not always on the second call, sometimes it's the third call, also I don't think it's a race condition, because the timing of the keystrokes doesn't seem to affect the outcome
Edit: I confirmed this will happen also inside typescript and lua files. I couldn't find a way to reproduce without running <S-v>
first, but the issue did occur before under different conditions
@perrin4869 What's <s-v>
mapped to in your config?
Largely copied the setup from the readme:
local tc = require("nvim-treeclimber")
-- Keymaps
vim.keymap.set("n", "<leader>k", tc.show_control_flow, {})
vim.keymap.set({ "x", "o" }, "i.", tc.select_current_node, { desc = "select current node" })
vim.keymap.set({ "x", "o" }, "a.", tc.select_expand, { desc = "select parent node" })
vim.keymap.set(
{ "n", "x", "o" },
"<M-e>",
tc.select_forward_end,
{ desc = "select and move to the end of the node, or the end of the next node" }
)
vim.keymap.set(
{ "n", "x", "o" },
"<M-b>",
tc.select_backward,
{ desc = "select and move to the begining of the node, or the beginning of the next node" }
)
vim.keymap.set({ "n", "x", "o" }, "<M-[>", tc.select_siblings_backward, {})
vim.keymap.set({ "n", "x", "o" }, "<M-]>", tc.select_siblings_forward, {})
vim.keymap.set(
{ "n", "x", "o" },
"<M-g>",
tc.select_top_level,
{ desc = "select the top level node from the current position" }
)
vim.keymap.set({ "n", "x", "o" }, "<M-h>", tc.select_backward, { desc = "select previous node" })
vim.keymap.set({ "n", "x", "o" }, "<M-j>", tc.select_shrink, { desc = "select child node" })
vim.keymap.set({ "n", "x", "o" }, "<M-k>", tc.select_expand, { desc = "select parent node" })
vim.keymap.set({ "n", "x", "o" }, "<M-l>", tc.select_forward, { desc = "select the next node" })
vim.keymap.set({ "n", "x", "o" }, "<M-L>", tc.select_grow_forward, { desc = "Add the next node to the selection" })
vim.keymap.set({ "n", "x", "o" }, "<M-H>", tc.select_grow_backward, { desc = "Add the next node to the selection" })
Edit: ah, <S-v>
is not mapped to anything, it's just for selecting a whole line
ok, this does seem to be fixed now, this time for real. I have no idea what was the cause and what was the fix π
I haven't found out yet how to reliably reproduce this, but sometimes when running multiple
select_expand
at once, the selected text is replaced withgk
. I thought I'd open an issue here in case anyone ran into this also.