Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.gsantner.markor.frontend.MarkorDialogFactory;
import net.gsantner.markor.frontend.textview.TextViewUtils;
import net.gsantner.markor.model.Document;
import net.gsantner.markor.util.TextCasingUtils;
import net.gsantner.opoc.util.GsCollectionUtils;
import net.gsantner.opoc.util.GsFileUtils;
import net.gsantner.opoc.wrapper.GsCallback;
Expand Down Expand Up @@ -106,7 +107,8 @@ public boolean onActionClick(final @StringRes int action) {
}
case R.string.abid_todotxt_priority: {
MarkorDialogFactory.showPriorityDialog(getActivity(), selTasks.get(0).getPriority(), (priority) -> {
setPriority(priority.length() == 1 ? priority.charAt(0) : TodoTxtTask.PRIORITY_NONE);
boolean isPriority = priority.length() == 1 && TextCasingUtils.isEnglishLetter(priority.charAt(0));
setPriority(isPriority ? priority.charAt(0) : TodoTxtTask.PRIORITY_NONE);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In many languages, the length of the word None (Nichts, Aucune, なし, ...) is greater than 1.
But in Simplified Chinese, this word was translated as a Chinese character , which has a length of 1, so the previous logic would consider it as an letter representing priority (A, B, C, ...).

});
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ public static String capitalizeSentences(String text) { // Capitalize the first
}
return result.toString();
}

public static boolean isEnglishLetter(char ch) {
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
}