mirror of https://github.com/espruino/BangleApps
kbmulti: add ability to lowercase after first capital
parent
855f196fd3
commit
78995305cb
|
@ -3,3 +3,4 @@
|
||||||
0.03: Use default Bangle formatter for booleans
|
0.03: Use default Bangle formatter for booleans
|
||||||
0.04: Allow moving the cursor
|
0.04: Allow moving the cursor
|
||||||
0.05: Switch swipe directions for Caps Lock and moving cursor.
|
0.05: Switch swipe directions for Caps Lock and moving cursor.
|
||||||
|
0.06: Add ability to auto-lowercase after a capital letter insertion.
|
||||||
|
|
|
@ -96,12 +96,14 @@ exports.input = function(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onKeyPad(key) {
|
function onKeyPad(key) {
|
||||||
|
var retire = 0;
|
||||||
deactivateTimeout(charTimeout);
|
deactivateTimeout(charTimeout);
|
||||||
// work out which char was pressed
|
// work out which char was pressed
|
||||||
if (key==charCurrent) {
|
if (key==charCurrent) {
|
||||||
charIndex = (charIndex+1) % letters[charCurrent].length;
|
charIndex = (charIndex+1) % letters[charCurrent].length;
|
||||||
text = text.slice(0, -1);
|
text = text.slice(0, -1);
|
||||||
} else {
|
} else {
|
||||||
|
retire = charCurrent !== undefined;
|
||||||
newCharacter(key);
|
newCharacter(key);
|
||||||
}
|
}
|
||||||
var newLetter = letters[charCurrent][charIndex];
|
var newLetter = letters[charCurrent][charIndex];
|
||||||
|
@ -110,14 +112,23 @@ exports.input = function(options) {
|
||||||
|
|
||||||
text = pre + (caps ? newLetter.toUpperCase() : newLetter.toLowerCase()) + post;
|
text = pre + (caps ? newLetter.toUpperCase() : newLetter.toLowerCase()) + post;
|
||||||
|
|
||||||
|
if(retire)
|
||||||
|
retireCurrent();
|
||||||
|
|
||||||
// set a timeout
|
// set a timeout
|
||||||
charTimeout = setTimeout(function() {
|
charTimeout = setTimeout(function() {
|
||||||
charTimeout = undefined;
|
charTimeout = undefined;
|
||||||
newCharacter();
|
newCharacter();
|
||||||
|
retireCurrent();
|
||||||
}, settings.charTimeout);
|
}, settings.charTimeout);
|
||||||
displayText(charTimeout);
|
displayText(charTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function retireCurrent(why) {
|
||||||
|
if (caps && settings.autoLowercase)
|
||||||
|
setCaps();
|
||||||
|
}
|
||||||
|
|
||||||
var moveMode = false;
|
var moveMode = false;
|
||||||
|
|
||||||
function onSwipe(dirLeftRight, dirUpDown) {
|
function onSwipe(dirLeftRight, dirUpDown) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ "id": "kbmulti",
|
{ "id": "kbmulti",
|
||||||
"name": "Multitap keyboard",
|
"name": "Multitap keyboard",
|
||||||
"version":"0.05",
|
"version":"0.06",
|
||||||
"description": "A library for text input via multitap/T9 style keypad",
|
"description": "A library for text input via multitap/T9 style keypad",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type":"textinput",
|
"type":"textinput",
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
format: v => v,
|
format: v => v,
|
||||||
onchange: v => updateSetting("charTimeout", v),
|
onchange: v => updateSetting("charTimeout", v),
|
||||||
},
|
},
|
||||||
|
/*LANG*/'Lowercase after first uppercase': {
|
||||||
|
value: !!settings().autoLowercase,
|
||||||
|
onchange: v => updateSetting("autoLowercase", v)
|
||||||
|
},
|
||||||
/*LANG*/'Show help button?': {
|
/*LANG*/'Show help button?': {
|
||||||
value: !!settings().showHelpBtn,
|
value: !!settings().showHelpBtn,
|
||||||
onchange: v => updateSetting("showHelpBtn", v)
|
onchange: v => updateSetting("showHelpBtn", v)
|
||||||
|
|
Loading…
Reference in New Issue