There's already a check in prepare_tagpreview that prevents a newly-created
window from exceeding previewheight.
It might make more sense to just use p_pvh regardless of whether it's less than 3.
My patch also assumes that p_pvh != 0 is the correct check for whether p_pvh is set.
Best,
Ben
---
src/popupmnu.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 0afa0b7..b0e564f 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -558,8 +558,8 @@ pum_set_selected(n, repeat)
win_T *curwin_save = curwin;
int res = OK;
- /* Open a preview window. 3 lines by default. */
- g_do_tagpreview = 3;
+ /* Open a preview window. min(p_pvh, 3) lines by default. */
+ g_do_tagpreview = (p_pvh && p_pvh < 3) ? p_pvh : 3;
resized = prepare_tagpreview(FALSE);
g_do_tagpreview = 0;
--
1.7.1
Not sure what I was referring to in the first post (p_pvh didn't seem to be
used in prepare_tagpreview). There's somewhere though that checks that a new
window isn't taller than p_pvh (which is how I knew the variable name was
p_pvh).
---
src/ex_cmds.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index d53652f..7119d0d 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5464,7 +5464,7 @@ prepare_tagpreview(undo_sync)
/*
* There is no preview window open yet. Create one.
*/
- if (win_split(g_do_tagpreview > 0 ? g_do_tagpreview : 0, 0)
+ if (win_split(g_do_tagpreview > 0 ? (p_pvh && p_pvh < g_do_tagpreview) ? p_pvh : g_do_tagpreview : 0, 0)
== FAIL)
return FALSE;
curwin->w_p_pvw = TRUE;
--
1.7.1
> This placement probably makes more sense (supersedes the prior patch),
> but the ternaries are getting really ugly.
>
> Not sure what I was referring to in the first post (p_pvh didn't seem
> to be used in prepare_tagpreview). There's somewhere though that
> checks that a new window isn't taller than p_pvh (which is how I knew
> the variable name was p_pvh).
>
Didn't see any response to this. It fixes the issue reported in two
threads[1,2]. Updated to make it less ugly (no complicated ternaries),
and match Vim coding style (I think -- didn't see a response to my query
about that).
[1] "Is this a bug with 'previewheight'?" - Daniel Vim - Sep 25
http://groups.google.com/group/vim_use/browse_thread/thread/3c365eac4c8b814c
[2] "how to set omnifunc complete window height (with img)" - Zac Lee - Sep 28
http://groups.google.com/group/vim_use/browse_thread/thread/a2a99470e827662b
Best,
Ben
---
src/ex_cmds.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index d53652f..801e325 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5464,6 +5464,9 @@ prepare_tagpreview(undo_sync)
/*
* There is no preview window open yet. Create one.
*/
+ /* Prefer previewheight over tagpreview, if set and smaller */
+ if (g_do_tagpreview && p_pvh && p_pvh < g_do_tagpreview)
+ g_do_tagpreview = p_pvh;
if (win_split(g_do_tagpreview > 0 ? g_do_tagpreview : 0, 0)
== FAIL)
return FALSE;
--
1.7.1
> On Wed, 29 Sep 2010, Benjamin R. Haskell wrote:
>
> > This placement probably makes more sense (supersedes the prior patch),
> > but the ternaries are getting really ugly.
> >
> > Not sure what I was referring to in the first post (p_pvh didn't seem
> > to be used in prepare_tagpreview). There's somewhere though that
> > checks that a new window isn't taller than p_pvh (which is how I knew
> > the variable name was p_pvh).
> >
>
> Didn't see any response to this. It fixes the issue reported in two
> threads[1,2]. Updated to make it less ugly (no complicated ternaries),
> and match Vim coding style (I think -- didn't see a response to my query
> about that).
>
> [1] "Is this a bug with 'previewheight'?" - Daniel Vim - Sep 25
> http://groups.google.com/group/vim_use/browse_thread/thread/3c365eac4c8b814c
>
> [2] "how to set omnifunc complete window height (with img)" - Zac Lee - Sep 28
> http://groups.google.com/group/vim_use/browse_thread/thread/a2a99470e827662b
Is this the same as this todo entry:
Patch to use 'previewheight' for popup menu. (Benjamin Haskell, 2010 Sep 29)
Or another one?
--
Apologies for taking up the bandwidth with the apology. Anything else I
can apologise for ...... er no can't think of anything, sorry about that.
Andy Hunt (Member of British Olympic Apology Squad)
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
>
> Benjamin Haskell wrote:
>
>> On Wed, 29 Sep 2010, Benjamin R. Haskell wrote:
>>
>>> [updated patch]
>>
>> Didn't see any response to this. [this = updated patch]
>> [updated patch again for style]
>>
>
> Is this the same as this todo entry:
>
> Patch to use 'previewheight' for popup menu. (Benjamin Haskell, 2010 Sep 29)
>
> Or another one?
The same, sorry. I didn't think to look for a todo without a list
response (makes sense in hindsight), but I also didn't see it in the log
due to hg problems. (Ended up on the vim72 branch after my last test of
`hg bisect` and hg was being a git -- probably through my own hg
ineptitude).
--
Best,
Ben