@bobfrankston/rmfmail 1.1.102 → 1.1.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/app.js CHANGED
@@ -3044,20 +3044,26 @@ document.addEventListener("keydown", (e) => {
3044
3044
  }
3045
3045
  }
3046
3046
  // Ctrl+D or Delete = Delete selected messages.
3047
- // P15: don't hijack Delete inside text inputs / textareas / contenteditable
3048
- // JSONC editor's Delete key was being eaten because we always preventDefault'd.
3049
- // 2026-05-09 fix: if the LIST has multiple selected rows, the user
3050
- // clearly means "delete those" regardless of where focus is search
3051
- // input retaining focus after filtering shouldn't make the key dead.
3052
- // Only defer to native behavior when there's no list selection AND
3053
- // focus is in a text-editing surface.
3047
+ // P15: don't hijack Delete inside text inputs / textareas / contenteditable.
3048
+ // Single-selection-while-typing was the bug Bob reported 2026-05-20:
3049
+ // search input has focus, list has an auto-selected row, user presses
3050
+ // Delete to backspace a character mailx hard-deletes the row. Data loss.
3051
+ //
3052
+ // The 2026-05-09 multi-select carve-out (Delete-key works on a list
3053
+ // selection even when focus drifted into search) is preserved only for
3054
+ // *explicit* multi-select (>1 row). Single selection is ALWAYS the
3055
+ // auto-selected first row — never an explicit "delete this" intent when
3056
+ // you're typing in search. So:
3057
+ // - focus in editable + ≤1 selected → native text edit (delete char)
3058
+ // - focus in editable + >1 selected → user multi-selected on purpose, run delete
3059
+ // - focus elsewhere → run delete
3054
3060
  if ((e.ctrlKey && e.key === "d") || e.key === "Delete") {
3055
3061
  const t = e.target;
3056
3062
  const tag = t?.tagName;
3057
3063
  const editable = t?.isContentEditable;
3058
3064
  const inEditable = tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || editable;
3059
3065
  const listSelectionCount = document.querySelectorAll("#ml-body .ml-row.selected").length;
3060
- if (inEditable && listSelectionCount === 0)
3066
+ if (inEditable && listSelectionCount <= 1)
3061
3067
  return;
3062
3068
  e.preventDefault();
3063
3069
  deleteSelection();