Anonymous avatar Anonymous committed 3646cb1

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

Comments (0)

Files changed (2)

ropemacs/interface.py

             lisputils.message(docs)
         else:
             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.")

ropemacs/lisputils.py

 
 
 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)
+
         lisp.goto_char(lisp.point_min())
     return new_buffer
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.