Skip to content

Commit

Permalink
Fix spacing (#1658)
Browse files Browse the repository at this point in the history
* Fix spacing
#1655

* lines

* lines
  • Loading branch information
stevencohn authored Nov 5, 2024
1 parent b5e665b commit 8999258
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions OneMore/UI/MoreAutoCompleteList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
{
string phrase;
SizeF size;
StringFormat format;

// track x-offset of each phrase
x = e.Bounds.X;
Expand All @@ -446,7 +447,7 @@ protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)
// when phrase is substring of word, GenericTypographic doesn't measure
// trailing space and when it is prefaced by a space, GenericDefault
// removes that space. So choose appropriate format carefully here
var format = index < text.Length - 1 && text[index - 1] == ' '
format = index < text.Length - 1 && text[index - 1] == ' '
? StringFormat.GenericDefault
: StringFormat.GenericTypographic;

Expand All @@ -457,12 +458,13 @@ protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e)

// draw matched phrase
phrase = text.Substring(index, Owner.Text.Length);
e.Graphics.DrawString(phrase, highFont, high,
x, e.Bounds.Y, StringFormat.GenericTypographic);

size = e.Graphics.MeasureString(
phrase, highFont, new PointF(x, e.Bounds.Y), StringFormat.GenericTypographic);
format = phrase[phrase.Length - 1] == ' '
? StringFormat.GenericDefault
: StringFormat.GenericTypographic;

e.Graphics.DrawString(phrase, highFont, high, x, e.Bounds.Y, format);
size = e.Graphics.MeasureString(phrase, highFont, new PointF(x, e.Bounds.Y), format);
x += size.Width;

// draw remaining phrase
Expand Down

0 comments on commit 8999258

Please sign in to comment.