Permalink
Browse files

fixes winstate after explorer pane grows to max height

  • Loading branch information...
1 parent 6b81fe3 commit 2cf6e2c949d7980982b09b5e9d8bf6f2468a98b3 @dlobraico dlobraico committed Jun 25, 2012
Showing with 8 additions and 4 deletions.
  1. +4 −2 plugin/lusty-explorer.vim
  2. +4 −2 src/lusty/display.rb
@@ -1821,6 +1821,7 @@ class Display
end
def create(prefix)
+ VIM::command("let g:winstate = winrestcmd()")
# Make a window for the display and move there.
# Start at size 1 to mitigate flashing effect when
@@ -2000,10 +2001,9 @@ class Display
end
def self.max_height
- VIM::command("let winstate = winrestcmd()") # save the current window state
VIM::command("resize") # the resize command defaults to the max height
highest_allowable = $curwin.height
- VIM::command("exe winstate") # restore the window state
+ VIM::command("exe g:winstate") # restore the window state
return highest_allowable
end
@@ -2071,7 +2071,9 @@ class Display
unlock_and_clear()
# Grow/shrink the window as needed
+ old_height = $curwin.height
$curwin.height = rows.length + (truncated ? 1 : 0)
+ VIM::command("exe g:winstate") if $curwin.height < old_height
# Print the rows.
rows.each_index do |i|
View
@@ -40,6 +40,7 @@ def initialize(title)
end
def create(prefix)
+ VIM::command("let g:winstate = winrestcmd()")
# Make a window for the display and move there.
# Start at size 1 to mitigate flashing effect when
@@ -219,10 +220,9 @@ def close
end
def self.max_height
- VIM::command("let winstate = winrestcmd()") # save the current window state
VIM::command("resize") # the resize command defaults to the max height
highest_allowable = $curwin.height
- VIM::command("exe winstate") # restore the window state
+ VIM::command("exe g:winstate") # restore the window state
return highest_allowable
end
@@ -290,7 +290,9 @@ def print_rows(rows, truncated)
unlock_and_clear()
# Grow/shrink the window as needed
+ old_height = $curwin.height
$curwin.height = rows.length + (truncated ? 1 : 0)
+ VIM::command("exe g:winstate") if $curwin.height < old_height
# Print the rows.
rows.each_index do |i|

0 comments on commit 2cf6e2c

Please sign in to comment.