Use extra-keys spelling and correct default setting

This commit is contained in:
Robert Vanden Eynde
2018-08-02 00:38:54 +02:00
committed by Fredrik Fornwall
parent b99d092305
commit f74293e8fb

View File

@@ -45,6 +45,13 @@ final class TermuxPreferences {
boolean mBackIsEscape; boolean mBackIsEscape;
boolean mShowExtraKeys; boolean mShowExtraKeys;
/**
* If value is not in the range [min, max], set it to either min or max.
*/
static int clamp(int value, int min, int max) {
return Math.min(Math.max(value, min), max);
}
TermuxPreferences(Context context) { TermuxPreferences(Context context) {
reloadFromProperties(context); reloadFromProperties(context);
@@ -68,7 +75,7 @@ final class TermuxPreferences {
} catch (NumberFormatException | ClassCastException e) { } catch (NumberFormatException | ClassCastException e) {
mFontSize = defaultFontSize; mFontSize = defaultFontSize;
} }
mFontSize = Math.max(MIN_FONTSIZE, Math.min(mFontSize, MAX_FONTSIZE)); mFontSize = clamp(mFontSize, MIN_FONTSIZE, MAX_FONTSIZE);
} }
boolean isShowExtraKeys() { boolean isShowExtraKeys() {
@@ -134,7 +141,7 @@ final class TermuxPreferences {
break; break;
} }
JSONArray arr = new JSONArray(props.getProperty("extrakeys", "[[\"ESC\",\"CTRL\",\"ALT\",\"TAB\",\"\",\"/\",\"|\"]]")); JSONArray arr = new JSONArray(props.getProperty("extra-keys", "[[\"ESC\",\"CTRL\",\"ALT\",\"TAB\",\"-\",\"/\",\"|\"]]"));
mExtraKeys = new String[arr.length()][]; mExtraKeys = new String[arr.length()][];
for(int i = 0; i < arr.length(); i++) { for(int i = 0; i < arr.length(); i++) {
JSONArray line = arr.getJSONArray(i); JSONArray line = arr.getJSONArray(i);