Skip to content

Commit

Permalink
Adjust visible password cell to have correct dimensions for when the …
Browse files Browse the repository at this point in the history
…password field has odd number of pixels for height
  • Loading branch information
Andy Kim committed Jun 16, 2014
1 parent 076bfd4 commit 3f23acc
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions KSPasswordField.m
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,10 @@ NSRect drawAdornments(NSRect cellFrame, NSView *controlView)

@implementation KSPasswordTextFieldCell

// =======================================================================================================
// =======================================================================================================
//
// ALL OF THIS CODE SHOULD BE COPIED TO SECTION BELOW, AND REMAIN EQUAL.
//
//

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
cellFrame = drawAdornments(cellFrame, controlView);
cellFrame.origin.y -= 1;

This comment has been minimized.

Copy link
@mackuba

mackuba Mar 26, 2015

Shouldn't this be wrapped in a check for showStrength like the ones below? As it is, it makes the text jump up and down by one pixel when you tab in and out of the field, which looks weird...

This comment has been minimized.

Copy link
@danwood

danwood Mar 27, 2015

Contributor

Hmm, I hadn't noticed that but a PR sounds in order, thanks

[super drawInteriorWithFrame:cellFrame inView:controlView];
}

Expand Down Expand Up @@ -254,7 +248,7 @@ - (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSTex
NSRect result = aRect;
if ([((KSPasswordField *)[self controlView]) showStrength])
{
result.origin.y += YOFFSET;
result.origin.y += YOFFSET - 1;
result.size.height -= YOFFSET;
}
[super selectWithFrame:result inView: controlView editor:textObj delegate:anObject start:selStart length:selLength];
Expand All @@ -265,7 +259,7 @@ - (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText
NSRect result = aRect;
if ([((KSPasswordField *)[self controlView]) showStrength])
{
result.origin.y += YOFFSET;
result.origin.y += YOFFSET - 1;
result.size.height -= YOFFSET;
}
[super editWithFrame:result inView: controlView editor:textObj delegate:anObject event: theEvent];
Expand Down

0 comments on commit 3f23acc

Please sign in to comment.