Skip to content

Commit c68d118

Browse files
committed
Fixes typos.
1 parent be70a76 commit c68d118

3 files changed

Lines changed: 69 additions & 67 deletions

File tree

Packages/RomanNumbers/Sources/RomanNumbers/RomanNumbers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public enum RomanNumbersErrors: Int, Error, LocalizedError {
99
public var errorDescription: String? {
1010
switch self {
1111
case .tooLarge:
12-
"Cannot be larger then 3999"
12+
"Cannot be larger than 3999"
1313
case .tooSmall:
14-
"Cannot be less then 0"
14+
"Cannot be less than 0"
1515
case .invalidInput:
1616
"Input is not a valid integer"
1717
}

Source/InputState.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class InputState: NSObject {
137137
),
138138
(
139139
NSLocalizedString("Roman Numbers (Alphabets)", comment: ""),
140-
{ .RomanNumber(style: .alphabet , number: "") }
140+
{ .RomanNumber(style: .alphabets , number: "") }
141141
),
142142
(
143143
NSLocalizedString("Roman Numbers (Full-width Upper Case)", comment: ""),
@@ -265,13 +265,13 @@ class InputState: NSObject {
265265
class RomanNumber: InputState {
266266
@objc(InputStateRomanNumberStyle)
267267
enum Style: Int {
268-
case alphabet = 0
268+
case alphabets = 0
269269
case fullWidthUpper = 1
270270
case fullWidthLower = 2
271271

272272
var label: String {
273273
switch self {
274-
case .alphabet:
274+
case .alphabets:
275275
"羅馬數字 (字母)"
276276
case .fullWidthUpper:
277277
"羅馬數字 (大寫全型)"

Source/KeyHandler.mm

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,20 +1344,20 @@ - (BOOL)_handleCandidateState:(InputState *)state
13441344
isCursorMovingRight = input.isRight;
13451345
} else {
13461346
switch (Preferences.allowMovingCursorWhenChoosingCandidates) {
1347-
case MovingCursorKeyUseJK:
1348-
isCursorMovingLeft = [input.inputText isEqualToString:@"j"];
1349-
isCursorMovingRight = [input.inputText isEqualToString:@"k"];
1350-
break;
1351-
case MovingCursorKeyUseHL:
1352-
isCursorMovingLeft = [input.inputText isEqualToString:@"h"];
1353-
isCursorMovingRight = [input.inputText isEqualToString:@"l"];
1354-
break;
1355-
default:
1356-
break;
1347+
case MovingCursorKeyUseJK:
1348+
isCursorMovingLeft = [input.inputText isEqualToString:@"j"];
1349+
isCursorMovingRight = [input.inputText isEqualToString:@"k"];
1350+
break;
1351+
case MovingCursorKeyUseHL:
1352+
isCursorMovingLeft = [input.inputText isEqualToString:@"h"];
1353+
isCursorMovingRight = [input.inputText isEqualToString:@"l"];
1354+
break;
1355+
default:
1356+
break;
13571357
}
13581358
}
13591359

1360-
if ([state isKindOfClass:[InputStateChoosingCandidate class]] && (isCursorMovingLeft || isCursorMovingRight) ) {
1360+
if ([state isKindOfClass:[InputStateChoosingCandidate class]] && (isCursorMovingLeft || isCursorMovingRight)) {
13611361
if (isCursorMovingLeft) {
13621362
size_t cursor = _grid->cursor();
13631363
if (cursor > 0) {
@@ -1425,37 +1425,39 @@ - (BOOL)_handleCandidateState:(InputState *)state
14251425
if (isPlusKey) {
14261426
InputStateCustomMenuEntry *boost = [[InputStateCustomMenuEntry alloc] initWithTitle:NSLocalizedString(@"Boost", @"")
14271427
callback:^{
1428-
__strong __typeof(weakSelf) strongSelf = weakSelf;
1429-
if (!strongSelf) {
1430-
return;
1431-
}
1432-
[strongSelf.delegate keyHandler:strongSelf didRequestBoostScoreForPhrase:candidate.value reading:reading];
1433-
[strongSelf.delegate keyHandlerDidRequestReloadLanguageModel:strongSelf];
1434-
[strongSelf _walk];
1435-
InputStateInputting *inputting = (InputStateInputting *)[strongSelf buildInputtingState];
1436-
stateCallback(inputting);
1437-
}];
1428+
__strong __typeof(weakSelf) strongSelf = weakSelf;
1429+
if (!strongSelf) {
1430+
return;
1431+
}
1432+
[strongSelf.delegate keyHandler:strongSelf didRequestBoostScoreForPhrase:candidate.value reading:reading];
1433+
[strongSelf.delegate keyHandlerDidRequestReloadLanguageModel:strongSelf];
1434+
[strongSelf _walk];
1435+
InputStateInputting *inputting = (InputStateInputting *)[strongSelf buildInputtingState];
1436+
stateCallback(inputting);
1437+
}];
14381438
[entries addObject:boost];
14391439
title = [NSString stringWithFormat:NSLocalizedString(@"Do you want to boost the score of the phrase \"%@\"?", @""), candidate.value];
14401440
} else if (isMinusKey) {
1441-
InputStateCustomMenuEntry *exclude = [[InputStateCustomMenuEntry alloc] initWithTitle:NSLocalizedString(@"Exclude", @"") callback:^{
1442-
__strong __typeof(weakSelf) strongSelf = weakSelf;
1443-
if (!strongSelf) {
1444-
return;
1445-
}
1446-
[strongSelf.delegate keyHandler:strongSelf didRequestExcludePhrase:candidate.value reading:reading];
1447-
[strongSelf.delegate keyHandlerDidRequestReloadLanguageModel:strongSelf];
1448-
[strongSelf _walk];
1449-
InputStateInputting *inputting = (InputStateInputting *)[strongSelf buildInputtingState];
1450-
stateCallback(inputting);
1451-
}];
1441+
InputStateCustomMenuEntry *exclude = [[InputStateCustomMenuEntry alloc] initWithTitle:NSLocalizedString(@"Exclude", @"")
1442+
callback:^{
1443+
__strong __typeof(weakSelf) strongSelf = weakSelf;
1444+
if (!strongSelf) {
1445+
return;
1446+
}
1447+
[strongSelf.delegate keyHandler:strongSelf didRequestExcludePhrase:candidate.value reading:reading];
1448+
[strongSelf.delegate keyHandlerDidRequestReloadLanguageModel:strongSelf];
1449+
[strongSelf _walk];
1450+
InputStateInputting *inputting = (InputStateInputting *)[strongSelf buildInputtingState];
1451+
stateCallback(inputting);
1452+
}];
14521453
[entries addObject:exclude];
14531454
title = [NSString stringWithFormat:NSLocalizedString(@"Do you want to exclude the phrase \"%@\"?", @""), candidate.value];
14541455
}
1455-
InputStateCustomMenuEntry *cancel = [[InputStateCustomMenuEntry alloc] initWithTitle:NSLocalizedString(@"Cancel", @"") callback:^{
1456-
stateCallback(currentState);
1457-
gCurrentCandidateController.selectedCandidateIndex = index;
1458-
}];
1456+
InputStateCustomMenuEntry *cancel = [[InputStateCustomMenuEntry alloc] initWithTitle:NSLocalizedString(@"Cancel", @"")
1457+
callback:^{
1458+
stateCallback(currentState);
1459+
gCurrentCandidateController.selectedCandidateIndex = index;
1460+
}];
14591461
[entries addObject:cancel];
14601462

14611463
InputStateCustomMenu *confirm = [[InputStateCustomMenu alloc] initWithComposingBuffer:[currentState composingBuffer] cursorIndex:[currentState cursorIndex] title:title entries:entries previousState:currentState selectedIndex:index];
@@ -1600,16 +1602,16 @@ - (BOOL)_handleCandidateState:(InputState *)state
16001602
isPageDown = charCode == 32 || input.isPageDown || input.emacsKey == McBopomofoEmacsKeyNextPage;
16011603
isPageUp = input.isPageUp;
16021604
switch (Preferences.allowMovingCursorWhenChoosingCandidates) {
1603-
case MovingCursorKeyUseJK:
1604-
isPageDown = isPageDown || [input.inputText isEqualToString:@"l"];
1605-
isPageUp = isPageUp || [input.inputText isEqualToString:@"h"];
1606-
break;
1607-
case MovingCursorKeyUseHL:
1608-
isPageDown = isPageDown || [input.inputText isEqualToString:@"k"];
1609-
isPageUp = isPageUp || [input.inputText isEqualToString:@"j"];
1610-
break;
1611-
default:
1612-
break;
1605+
case MovingCursorKeyUseJK:
1606+
isPageDown = isPageDown || [input.inputText isEqualToString:@"l"];
1607+
isPageUp = isPageUp || [input.inputText isEqualToString:@"h"];
1608+
break;
1609+
case MovingCursorKeyUseHL:
1610+
isPageDown = isPageDown || [input.inputText isEqualToString:@"k"];
1611+
isPageUp = isPageUp || [input.inputText isEqualToString:@"j"];
1612+
break;
1613+
default:
1614+
break;
16131615
}
16141616

16151617
if (isPageDown) {
@@ -1852,7 +1854,7 @@ - (BOOL)_handleNumberState:(InputState *)state
18521854
}
18531855

18541856
if (charCode == 13) {
1855-
if (!numberState.number.count) {
1857+
if (!numberState.number.length) {
18561858
InputStateEmpty *empty = [[InputStateEmpty alloc] init];
18571859
stateCallback(empty);
18581860
return YES;
@@ -1924,9 +1926,9 @@ - (BOOL)_handleNumberState:(InputState *)state
19241926
}
19251927

19261928
- (BOOL)_handleRomanNumberState:(InputState *)state
1927-
input:(KeyHandlerInput *)input
1928-
stateCallback:(void (^)(InputState *))stateCallback
1929-
errorCallback:(void (^)(void))errorCallback;
1929+
input:(KeyHandlerInput *)input
1930+
stateCallback:(void (^)(InputState *))stateCallback
1931+
errorCallback:(void (^)(void))errorCallback;
19301932
{
19311933
InputStateRomanNumber *numberState = (InputStateRomanNumber *)state;
19321934
UniChar charCode = input.charCode;
@@ -1950,7 +1952,7 @@ - (BOOL)_handleRomanNumberState:(InputState *)state
19501952
}
19511953

19521954
if (charCode == 13) {
1953-
if (!numberState.number.count) {
1955+
if (!numberState.number.length) {
19541956
InputStateEmpty *empty = [[InputStateEmpty alloc] init];
19551957
stateCallback(empty);
19561958
return YES;
@@ -1959,17 +1961,17 @@ - (BOOL)_handleRomanNumberState:(InputState *)state
19591961
RomanNumbersStyle style = RomanNumbersStyleAlphabets;
19601962

19611963
switch (numberState.style) {
1962-
case InputStateRomanNumberStyleAlphabet:
1963-
style = RomanNumbersStyleAlphabets;
1964-
break;
1965-
case InputStateRomanNumberStyleFullWidthUpper:
1966-
style = RomanNumbersStyleFullWidthUpper;
1967-
break;
1968-
case InputStateRomanNumberStyleFullWidthLower:
1969-
style = RomanNumbersStyleFullWidthLower;
1970-
break;
1971-
default:
1972-
break;
1964+
case InputStateRomanNumberStyleAlphabets:
1965+
style = RomanNumbersStyleAlphabets;
1966+
break;
1967+
case InputStateRomanNumberStyleFullWidthUpper:
1968+
style = RomanNumbersStyleFullWidthUpper;
1969+
break;
1970+
case InputStateRomanNumberStyleFullWidthLower:
1971+
style = RomanNumbersStyleFullWidthLower;
1972+
break;
1973+
default:
1974+
break;
19731975
}
19741976

19751977
NSError *error = nil;

0 commit comments

Comments
 (0)