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

Resize window edge determination looks strange with winfixwidth and winfixheight #28

Open
KSR-Yasuda opened this issue May 16, 2022 · 0 comments

Comments

@KSR-Yasuda
Copy link

For example below,
the window * is considered not right edge,
and it works as if the window's right partition can be movable
(i.e left key (j) decreases window width / right key (l) increases).

This looks quite strange.

+-----+-----+-----+
|     |     |     |
|     |  *  | wfw |
|     |     |     |
+-----+-----+-----+
      ^
      This moves

I tried to fix it like below, however, it is still incomplete.

--- a/autoload/winresizer.vim
+++ b/autoload/winresizer.vim
@@ -13,12 +13,12 @@ fun! winresizer#getEdgeInfo()
   let chk_direct = ['left', 'down', 'up', 'right']
   let result = {}
   for direct in chk_direct
-    exe 'let result["' . direct . '"] = ' . !winresizer#canMoveCursorFromCurrentWindow(direct)
+    exe 'let result["' . direct . '"] = ' . !winresizer#canMoveCursorToResizableWindowFromCurrentWindow(direct)
   endfor
   return result
 endfun
 
-fun! winresizer#canMoveCursorFromCurrentWindow(direct)
+fun! winresizer#canMoveCursorToResizableWindowFromCurrentWindow(direct)
   let map_direct = {'left':'h', 'down':'j', 'up':'k', 'right':'l'}
   if has_key(map_direct, a:direct)
     let direct = map_direct[a:direct]
@@ -28,8 +28,9 @@ fun! winresizer#canMoveCursorFromCurrentWindow(direct)
   let from = winnr()
   exe "wincmd " . direct
   let to = winnr()
+  let fixed = (a:direct ==# 'up' || a:direct ==# 'down') ? &winfixheight : &winfixwidth
   exe from . "wincmd w"
-  return from != to
+  return from != to && !fixed
 endfun
 
 fun! winresizer#swapTo(direct)

With the window arrangement like below,
the right partition of the window * moves.

+-----+-----+-----+
|     |     |     |
|     |     | wfw |
|     |     |     |
|     |     +-----+
|     |     |     |
|     |  *  | wfw |
|     |     |     |
|     |     +-----+
|     |     |     |
|     |     | wfw |
|     |     |     |
+-----+-----+-----+
            ^
            This moves
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

1 participant