Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

SDK Package: SpaceNegotiatingAdornmentTag bug?

$
0
0

(I'm using C#, Visual Studio 2010 on Window 7)

I'm trying to add some extra vertical spacing between certain source code lines in the Visual Studio text editor. I've added a SpaceNegotiatingAdornmentTag of width zero at the start of each line that I want to add spacing to. If I just set the bottomSpace parameter of the Space Negotiating constructor then it works as intended.

I'm curious, however as to the semantics of the other parameters (baseLine, textHeight, bottomSpace). If you add a SpaceNegotiatingAdornmentTag to a line then it affects the layout of the text within that line. I've tried setting various combinations of these parameters and now have a rough understanding/guess as to the semantics of these parameters that I would like to have verified. It would be easiest to describe this with a diagram, but I'll do my test to explain textually. So within the line we have the vertical region used to display the actual text - lets call this T. Then we have the vertical region where the caret/selection is displayed (you would think this should always correspond to T, but it doesn't appear to do so) which we'll call S. Finally we have the vertical region used to display the line in it's entirety, including top and bottom margins/spacing, lets call this L. The baseLine parameter determines the distance from the top of L to the bottom of T. The topSpace parameter determines the distance from the top of L to the top of S. The bottomSpace parameter determines the distance from the bottom of S to the bottom of L. The height of T is determined by the font size. Surprisingly, the height of S appears to depend primarily on baseLine (baseLine - topSpace would make more sense). The height of L is then topSpace + height of S + bottomSpace. The textHeight parameter doesn't appear to affect any of these height calculations. At least that's my current guess based on observations. BTW, IntraTextAdornmentTag takes the same parameters and appears to operate in much the same manner. The above can be reproduced by changing line 167 of IntraTextAdornmentTagger.cs in the IntraText Adornment sample to include these extra parameters in the call to the constructor - run the extension and highlight some of the text on a line containing one of these adornment tags.

Any insight gratefully received.

Cheers, Wayne.



Viewing all articles
Browse latest Browse all 4410

Trending Articles