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

Drag Reordering only when mouse hovering tab #193

Closed
Meridolian opened this issue Feb 29, 2024 · 6 comments · May be fixed by #171
Closed

Drag Reordering only when mouse hovering tab #193

Meridolian opened this issue Feb 29, 2024 · 6 comments · May be fixed by #171
Labels
bug Something isn't working

Comments

@Meridolian
Copy link

Meridolian commented Feb 29, 2024

Hi !
I enabled mouse (disable_mouse = false) so I can drag buffers and reorder them, but this feature works on the ENTIRE buffer. I mean if i click + drag inside the buffer, it does activate the buffers reordering.
This is pretty annoying because when i want to select lines or words in the buffer, the selection "freeze" until I release my mouse button.

Is it a bug or a feature ?

If it is a feature to reorder inside the buffer, is it possible to deactivate it or maybe just enable it only when hovering a tab ?

@Meridolian Meridolian closed this as not planned Won't fix, can't repro, duplicate, stale Feb 29, 2024
@Meridolian Meridolian reopened this Feb 29, 2024
@Meridolian Meridolian changed the title Drag Reordering only when mouse Drag Reordering only when mouse hovering tab Feb 29, 2024
@willothy
Copy link
Owner

Hmm that is not the intended behavior, and is not how it works for me. Mouse mappings should work like normal. Mind providing some more info about your environment / nvim version?

@willothy willothy added the bug Something isn't working label Feb 29, 2024
@Meridolian
Copy link
Author

Meridolian commented Feb 29, 2024

Thanks for your reactivity ! :)

Here a video to show you what's happening :
Kooha-2024-02-29-16-33-28.webm

About my environment, I'm on Arch Linux with Hyprland (so Wayland), with a Nvidia GPU, Neovim 0.9.5, Cokeline installed from main branch.

and here's my cokeline config :

return {
    "willothy/nvim-cokeline";
    dependencies = {
        "stevearc/resession.nvim";
    };
    config = function()
        local palette = require("../config/palette")

        vim.o.mousemoveevent = true;  -- Needed for hover events

        require("cokeline").setup({
            show_if_buffers_are_at_least = 0;
            buffers = {
                filter_valid = false;
                focus_on_delete = "next";
                new_buffers_position = "last";
                delete_on_right_click = false;
            };
            mappings = {
                cycle_prev_next = true;
                disable_mouse = false;
            };
            history = {
                enabled = true;
                size = 50;
            };
            rendering = {
                max_buffer_width = 50;
            };
            pick = {
                use_filename = true;
                letters = "asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERTYQP";
            };
            default_hl = {
                fg = function(buffer)
                    return buffer.is_focused and palette.white or palette.dark_light;
                end;
                bg = function(buffer)
                    return buffer.is_focused and palette.dark_light or palette.dark;
                end;
                bold = true;
            };
            fill_hl = "Normal";
            components = {
                {
                    text = "";
                    fg = function(buffer)
                        if buffer.is_focused or buffer.buf_hovered then
                            return palette.green;
                        end;
                        return palette.dark_light;
                    end;
                    bg = palette.dark;
                    truncation = {
                        priority = 1;
                        direction = "middle";
                    }
                };
                {
                    text = function(buffer)
                        return " " .. buffer.devicon.icon;
                    end;
                    fg = function(buffer)
                        if buffer.is_focused or buffer.buf_hovered then
                            return palette.dark;
                        end;
                        return palette.white;
                    end;
                    bg = function(buffer)
                        if buffer.is_focused or buffer.buf_hovered then
                            return palette.green;
                        end;
                        return palette.dark_light;
                    end;
                    truncation = {
                        priority = 1;
                        direction = "middle";
                    }
                };
                {
                    text = function(buffer)
                        return buffer.filename;
                    end;
                    fg = function(buffer)
                        if buffer.is_focused or buffer.buf_hovered then
                            return palette.dark;
                        end;
                        return palette.white;
                    end;
                    bg = function(buffer)
                        if buffer.is_focused or buffer.buf_hovered then
                            return palette.green;
                        end;
                        return palette.dark_light;
                    end;
                    truncation = {
                        priority = 2;
                        direction = "right";
                    }
                };
                {
                    text = function(buffer)
                        if buffer.is_modified then
                            return "  ";
                        end;
                        if buffer.is_readonly then
                            return "  ";
                        end;
                        if buffer.is_hovered then
                            return " 󰅙 ";
                        end;
                        return " 󰅖 ";
                    end;
                    on_click = function(_, _, _, _, buffer)
                        buffer:delete();
                    end;
                    fg = function(buffer)
                        if buffer.is_focused or buffer.buf_hovered then
                            return palette.dark;
                        end;
                        return palette.white;
                    end;
                    bg = function(buffer)
                        if buffer.is_focused or buffer.buf_hovered then
                            return palette.green;
                        end;
                        return palette.dark_light;
                    end;
                    truncation = {
                        priority = 1;
                        direction = "middle";
                    }
                };
                {
                    text = "";
                    fg = function(buffer)
                        if buffer.is_focused or buffer.buf_hovered then
                            return palette.green;
                        end;
                        return palette.dark_light;
                    end;
                    bg = palette.dark;
                    truncation = {
                        priority = 1;
                        direction = "middle";
                    }
                };
            };
            sidebar = {
                filetype = { "neo-tree"; };
                components = {
                    {
                        text = "NeoTree";
                        fg = palette.purple;
                        bg = palette.dark;
                        bold = true;
                    };
                };
            };
        });
    end;
}

@willothy
Copy link
Owner

willothy commented Feb 29, 2024

Hmm, alright. Not sure what's causing this since you're on 0.9 so vim.on_key should be available. I'll look into this as soon as I can, thanks for the info!

@willothy
Copy link
Owner

This was totally an oversight on my part! Not sure how I (or others, until now) didn't notice haha. Fixed!

@Meridolian
Copy link
Author

I tested it and it is fixed ! Thanks 😄 (really cool LFA pic btw)

@willothy
Copy link
Owner

Awesome!

Haha thanks, pretty sure I just found it on google in like 2015 and never changed it 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants