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.04: Allow moving the 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) {
|
||||
var retire = 0;
|
||||
deactivateTimeout(charTimeout);
|
||||
// work out which char was pressed
|
||||
if (key==charCurrent) {
|
||||
charIndex = (charIndex+1) % letters[charCurrent].length;
|
||||
text = text.slice(0, -1);
|
||||
} else {
|
||||
retire = charCurrent !== undefined;
|
||||
newCharacter(key);
|
||||
}
|
||||
var newLetter = letters[charCurrent][charIndex];
|
||||
|
@ -109,15 +111,24 @@ exports.input = function(options) {
|
|||
let post = text.slice(textIndex, text.length);
|
||||
|
||||
text = pre + (caps ? newLetter.toUpperCase() : newLetter.toLowerCase()) + post;
|
||||
|
||||
if(retire)
|
||||
retireCurrent();
|
||||
|
||||
// set a timeout
|
||||
charTimeout = setTimeout(function() {
|
||||
charTimeout = undefined;
|
||||
newCharacter();
|
||||
retireCurrent();
|
||||
}, settings.charTimeout);
|
||||
displayText(charTimeout);
|
||||
}
|
||||
|
||||
function retireCurrent(why) {
|
||||
if (caps && settings.autoLowercase)
|
||||
setCaps();
|
||||
}
|
||||
|
||||
var moveMode = false;
|
||||
|
||||
function onSwipe(dirLeftRight, dirUpDown) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "kbmulti",
|
||||
"name": "Multitap keyboard",
|
||||
"version":"0.05",
|
||||
"version":"0.06",
|
||||
"description": "A library for text input via multitap/T9 style keypad",
|
||||
"icon": "app.png",
|
||||
"type":"textinput",
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
format: v => v,
|
||||
onchange: v => updateSetting("charTimeout", v),
|
||||
},
|
||||
/*LANG*/'Lowercase after first uppercase': {
|
||||
value: !!settings().autoLowercase,
|
||||
onchange: v => updateSetting("autoLowercase", v)
|
||||
},
|
||||
/*LANG*/'Show help button?': {
|
||||
value: !!settings().showHelpBtn,
|
||||
onchange: v => updateSetting("showHelpBtn", v)
|
||||
|
|
Loading…
Reference in New Issue