Subject: Re: bug#5908: tooltip-show breaks with multiline tip on Emacs for Windows v22.2.1

From: "D Chiesa" <[email-masked]>
Date: Fri, 9 Apr 2010 10:18:27 -0400

> This is a known and a nasty problem, present in Emacs 23 as well.  The
> ugly part is that the behavior depends on the size of the font used
> for the tooltips.  If you play with that font's definition, you will
> eventually find a size where the clipping doesn't happen.  (The value
> depends on the size and resolution of your monitor.)
>
> Someone who knows much more about GUI display than I do should look
> into this, because I can spot nothing wrong in the code.
>

Thanks   I'll look into adjusting the font myself.
As another workaround, individuals can use advice on tooltip-show.  If you 
append a newline onto the text, it tends to display without clipping, 
although you get the opposite problem - too much dead space.

    (defun cheeso-reform-string (limit arg)
      (let ((orig arg) (modified "") (curline "") word
            (words (split-string arg " ")))
        (while words
          (progn
            (setq curline "")
            (while (and words (< (length curline) limit))
              (progn
                (setq word (car words))
                (setq words (cdr words))
                (setq curline (concat curline " " word))))
            (setq modified (concat modified curline "\n"))))
        (setq modified (concat modified " \n")))
      )

    (defadvice tooltip-show (before
                             flymake-csharp-fixup-tooltip
                             (arg &optional use-echo-area)
                             activate compile)
      (progn
        (if (and (not use-echo-area)
                 (eq major-mode 'csharp-mode))
            (let ((orig (ad-get-arg 0)))
              (ad-set-arg 0 (cheeso-reform-string 72 orig))
              ))))