修复西班牙语bug
This commit is contained in:
@@ -127,6 +127,9 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
||||
}
|
||||
|
||||
KBKeyboardLayout *layout = [self kb_currentLayout];
|
||||
NSLog(@"[KBKeyboardView] reloadKeys: layoutName=%@ rows=%lu shiftRows=%lu shiftOn=%d",
|
||||
self.currentLayoutJsonId, (unsigned long)layout.rows.count, (unsigned long)layout.shiftRows.count, self.shiftOn);
|
||||
|
||||
NSArray<KBKeyboardRowConfig *> *rows = nil;
|
||||
|
||||
if (self.shiftOn && layout.shiftRows.count > 0) {
|
||||
@@ -135,7 +138,10 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
||||
rows = layout.rows ?: @[];
|
||||
}
|
||||
|
||||
NSLog(@"[KBKeyboardView] reloadKeys: usingRows=%lu", (unsigned long)rows.count);
|
||||
|
||||
if (rows.count < 4) {
|
||||
NSLog(@"[KBKeyboardView] reloadKeys: rows.count < 4, fallback to legacy");
|
||||
[self kb_buildLegacyLayout];
|
||||
return;
|
||||
}
|
||||
@@ -146,6 +152,7 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
||||
[self buildRow:self.row4 withRowConfig:rows[3]];
|
||||
|
||||
NSUInteger totalButtons = [self kb_totalKeyButtonCount];
|
||||
NSLog(@"[KBKeyboardView] reloadKeys: totalButtons=%lu", (unsigned long)totalButtons);
|
||||
if (totalButtons == 0) {
|
||||
NSLog(@"[KBKeyboardView] config layout produced no keys, fallback to legacy.");
|
||||
for (UIView *row in @[self.row1, self.row2, self.row3, self.row4]) {
|
||||
@@ -376,7 +383,7 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
||||
|
||||
// 字母键工厂:根据 shiftOn 决定显示与输出大小写
|
||||
- (KBKey *)kb_letterKeyWithChar:(NSString *)charString {
|
||||
NSParameterAssert(charString.length == 1);
|
||||
if (charString.length == 0) { return nil; }
|
||||
NSString *lower = charString.lowercaseString;
|
||||
NSString *upper = charString.uppercaseString;
|
||||
|
||||
@@ -1151,7 +1158,7 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
|
||||
NSString *prefix = [itemId substringToIndex:range.location];
|
||||
NSString *value = [itemId substringFromIndex:range.location + 1];
|
||||
if ([prefix isEqualToString:@"letter"]) {
|
||||
if (value.length == 1) {
|
||||
if (value.length >= 1) {
|
||||
return [self kb_letterKeyWithChar:value];
|
||||
}
|
||||
return nil;
|
||||
|
||||
Reference in New Issue
Block a user