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

Avoid collision with the global status line #189

Open
sassanh opened this issue Apr 7, 2023 · 8 comments
Open

Avoid collision with the global status line #189

sassanh opened this issue Apr 7, 2023 · 8 comments

Comments

@sassanh
Copy link

sassanh commented Apr 7, 2023

Similar issue: #4

image

I'm using bottom up layout, and the notifications cover the status line. The value of these options in my setup may be relevant:

vim.opt.cmdheight = 0
vim.opt.laststatus = 3

Not sure if this is considered an issue with the plugin or if I just need to improve my setup.

@ranomier
Copy link

ranomier commented May 3, 2023

I have the same problem, i want to move the notification one row up.

Also it is visually displeasing, because it feels like it blinks. The status bar has a different color and that color suddenly changes two times.

@ranomier
Copy link

ranomier commented May 3, 2023

@sassanh This is a dirty fix:

diff --git a/lua/notify/stages/util.lua b/lua/notify/stages/util.lua
index cc68974..d20c6ae 100644
--- a/lua/notify/stages/util.lua
+++ b/lua/notify/stages/util.lua
@@ -88,6 +88,7 @@ function M.get_slot_range(direction)
   local top = vim.opt.tabline:get() == "" and 0 or 1
   local bottom = vim.opt.lines:get()
     - (vim.opt.cmdheight:get() + (vim.opt.laststatus:get() > 0 and 1 or 0))
+  local bottom = bottom - 1
   local left = 1
   local right = vim.opt.columns:get()
   if M.DIRECTION.TOP_DOWN == direction then

midekra added a commit to midekra/nvim-notify that referenced this issue Aug 3, 2023
midekra added a commit to midekra/nvim-notify that referenced this issue Aug 3, 2023
@dasupradyumna
Copy link

I also have the same issue, @rcarriga. Is it possible to include this change into the plugin?
I'll be happy to open a PR for this minor change.

dasupradyumna added a commit to dasupradyumna/nvim-notify that referenced this issue Nov 6, 2023
Old implementation does not work properly because it -
1. overlaps the global statusline (off by 1 row), bottom limit
2. uses `tabline` option instead of `showtabline`, top limit
@dasupradyumna
Copy link

Hey guys, check out my PR and let me know if it fixes things for you.

Comment on the PR so Ronan can merge it sooner.

isak102 added a commit to isak102/nvim-notify that referenced this issue Jan 28, 2024
@nullromo
Copy link

For me, using fade_in_slide_out positions the notification correctly, while fade, slide, and static position it over the statusline.

Position with fade_in_slide_out 😄

Screenshot 2024-01-31 095455

Position with fade, slide, or static 😞

Screenshot 2024-01-31 095441

Not sure why the stages option affects the positioning of the notification.

@tom-gora
Copy link

This override works perfectly fine for me:

  {
    "rcarriga/nvim-notify",
    config = vim.schedule(function()
      local override = function(direction)
        local top = 0
        local bottom = vim.opt.lines:get()
            - (vim.opt.cmdheight:get() + (vim.opt.laststatus:get() > 0 and 1 or 0))
        if vim.wo.winbar then
          bottom = bottom - 1
        end
        local left = 1
        local right = vim.opt.columns:get()
        if direction == "top_down" then
          return top, bottom
        elseif direction == "bottom_up" then
          return bottom, top
        elseif direction == "left_right" then
          return left, right
        elseif direction == "right_left" then
          return right, left
        end
        error(string.format("Invalid direction: %s", direction))
      end
      local util = require("notify.stages.util")
      util.get_slot_range = override
    end),
-- ...

@chardskarth
Copy link

@tom-gora how are you setting the direction? In the docs, top_down is only a boolean config.

@tom-gora
Copy link

@chardskarth Have a look at my dots: LINK. Essentially I stole some code from some places and cobbled together a nice solution. direction is not a key here - it is a parameter passed into override function that returns values for notify.stages.util.get_slot_range

Recording_31-Jul_12-02-08_4247.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants