Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move cursor for separated verbs #321

Merged
merged 2 commits into from
Jun 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions Keyboards/KeyboardsBase/ScribeFunctionality/Conjugate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ func returnConjugation(keyPressed: UIButton, requestedForm: String) {
if wordPressed == invalidCommandMsg {
proxy.insertText("")
} else if formsDisplayDimensions == .view3x2 {
if deConjugationState != .indicativePerfect {
let query = "SELECT * FROM verbs WHERE verb = ?"
let args = [verbToConjugate]
let outputCols = [requestedForm]
Expand All @@ -232,14 +231,6 @@ func returnConjugation(keyPressed: UIButton, requestedForm: String) {
} else {
proxy.insertText(wordToReturn + " ")
}
} else {
let query = "SELECT * FROM verbs WHERE verb = ?"
let args = [verbToConjugate]
let outputCols = ["pastParticiple"]
wordToReturn = queryDBRow(query: query, outputCols: outputCols, args: args)[0]

proxy.insertText(wordToReturn + " ")
}
} else if formsDisplayDimensions == .view2x2 {
let query = "SELECT * FROM verbs WHERE verb = ?"
let args = [verbToConjugate]
Expand All @@ -252,6 +243,12 @@ func returnConjugation(keyPressed: UIButton, requestedForm: String) {
proxy.insertText(wordToReturn + " ")
}
}
if controllerLanguage == "German" {
let components = wordToReturn.components(separatedBy: " ")
if components.count == 2 {
proxy.adjustTextPosition(byCharacterOffset: (components[1].count + 1) * -1)
}
}
Comment on lines +246 to +251
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, perhaps a question more for you, @andrewtavis

Was wondering as well - could the functions throughout the code be modified to be more generic/language-agnostic? I'm thinking generally that any functionality that's pretty universal can stay where they are, but for instance, German-specific checks/logic can go under Keyboards/LanguageKeyboards/German/*.swift. Thought of this as I was thinking code may get messy/hard-to-read with language-specific logic sprinkled around, especially as more languages are added over time (and their exceptions and quirks along with them).

Note: This doesn't have to be a part of this PR; can be done later as it might require some refactoring. Just curious on thoughts on the above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Met offline with @andrewtavis and @SaurabhJamadagni on the above. There's consensus that refactoring language-specific logic out from the base keyboard should be something Scribe should look to. Created the issue #323 to cover for this. Please anyone feel free to add any thoughts or ideas there! 😄

Also, another good idea could be to keep this refactoring in mind as other work is done throughout the project. If feasible to implement language-specific logic already separated out, do so 🚀

autoActionState = .suggest
commandState = .idle
conjViewShiftButtonsState = .bothInactive
Expand Down