From d6db4e6be355486fbee91a6ae0b83e81b285e6df Mon Sep 17 00:00:00 2001 From: thyttan <97237430+thyttan@users.noreply.github.com> Date: Wed, 11 May 2022 19:49:40 +0200 Subject: [PATCH] Update lib.js --- apps/kbmulti/lib.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/kbmulti/lib.js b/apps/kbmulti/lib.js index ff987c2cc..052fd86a1 100644 --- a/apps/kbmulti/lib.js +++ b/apps/kbmulti/lib.js @@ -1,14 +1,14 @@ //Multitap logic originally from here: http://www.espruino.com/Morse+Code+Texting exports.input = function(options) { - options = options||{}; + var options = options||{}; var text = options.text; if ("string"!=typeof text) text=""; var settings = require('Storage').readJSON("kbmulti.settings.json", true) || {}; //if (settings.firstLaunch===undefined) { settings.firstLaunch = true; } if (settings.charTimeout===undefined) { settings.charTimeout = 500; } - if (settings.showHelpBtn===undefined) { settings.showHelpBtn = true; } + if (settings.showHelpBtn===undefined) { settings.showHelpBtn = false; } var fontSize = "6x15"; var Layout = require("Layout"); @@ -25,9 +25,9 @@ exports.input = function(options) { var caps = true; var layout; - function displayText() { + function displayText(charTimeout) { layout.clear(layout.text); - layout.text.label = text.slice(-12); + layout.text.label = text.slice(settings.showHelpBtn ? -12 : -13) + (charTimeout ? " " : "_"); layout.render(layout.text); } @@ -70,12 +70,12 @@ exports.input = function(options) { } var newLetter = letters[charCurrent][charIndex]; text += (caps ? newLetter.toUpperCase() : newLetter.toLowerCase()); - displayText(); // set a timeout charTimeout = setTimeout(function() { charTimeout = undefined; newCharacter(); }, settings.charTimeout); + displayText(charTimeout); } function onSwipe(dirLeftRight, dirUpDown) { @@ -139,6 +139,7 @@ exports.input = function(options) { require('Storage').writeJSON("kbmulti.settings.json", settings); } else { generateLayout(resolve,reject); + displayText(false); Bangle.on('swipe', onSwipe); layout.render(); }