]> git.scottworley.com Git - vopamoi/commitdiff
Don't select-all the task description when beginning editing
authorScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 08:36:25 +0000 (00:36 -0800)
committerScott Worley <scottworley@scottworley.com>
Thu, 27 Jan 2022 20:21:55 +0000 (12:21 -0800)
I find that
 * most edits are more gentle than complete replacement
 * I consistently reach for the "end" key to begin editing
 * If I want complete replacement, ^A is easier to type than "end"

vopamoi.ts

index 7bdf4b83969eaaad28ba662182fbfe25823cca62..01e761cc73ef59c37c091d4b3cb7d35918879a12 100644 (file)
@@ -49,12 +49,11 @@ const Model = {
       const input = target.children[0] as HTMLInputElement;
       if (
         input.value === target.getAttribute("data-description") &&
-        input.selectionStart === 0 &&
+        input.selectionStart === input.value.length &&
         input.selectionEnd === input.value.length
       ) {
         // No local changes have actually been made yet.  Change the contents of the edit box!
         input.value = newDescription;
-        input.select();
       } else {
         // No great options.
         // Prefer not to interrupt the local user's edit.
@@ -215,7 +214,6 @@ function BrowserUI() {
       task.textContent = "";
       task.appendChild(input);
       input.focus();
-      input.select();
       event.preventDefault();
     },