1. Nicolae Dascalu
  2. ropemacs


Stefan Reichör  committed 3646cb1

Fit the buffer size to the number of needed lines for rope-show-doc and introduced ropemacs-max-doc-buffer-height

  • Participants
  • Parent commits 62d7925
  • Branches trunk

Comments (0)

Files changed (2)

File ropemacs/interface.py

View file
  • Ignore whitespace
             buffer = lisputils.make_buffer('*rope-pydoc*', docs,
-                                           empty_goto=False)
+                                           empty_goto=False,
+                                           fit_lines = lisp["ropemacs-max-doc-buffer-height"].value())
             lisp.local_set_key('q', lisp.bury_buffer)
     @local_command('a f', shortcut='C-c f')
   "The number of errors to fix before code-assist.
 How many errors to fix, at most, when proposing code completions.")
 (defcustom ropemacs-separate-doc-buffer t
   "Should `rope-show-doc' use a separate buffer or the minibuffer.")
+(defcustom ropemacs-max-doc-buffer-height 22
+  "The maximum buffer height for `rope-show-doc'.")
 (defcustom ropemacs-enable-autoimport 'nil
   "Specifies whether autoimport should be enabled.")

File ropemacs/lisputils.py

View file
  • Ignore whitespace
 def make_buffer(name, contents, empty_goto=True,
-                switch=False, window='other', modes=[]):
+                switch=False, window='other', modes=[],
+                fit_lines=None):
     """Make an emacs buffer
     `window` can be one of `None`, 'current' or 'other'.
         elif window == 'other':
             new_window = lisp.display_buffer(new_buffer)
             lisp.set_window_point(new_window, lisp.point_min())
+            if fit_lines != None:
+                max_height = min(fit_lines,
+                                 lisp.count_lines(lisp.point_min(),
+                                                  lisp.point_max())) + 1
+                lisp.fit_window_to_buffer(new_window, max_height, max_height)
     return new_buffer