flow: close the @-mention list once the recipient is chosen
The composer's suggestion list stayed open for as long as the line started with a name that matched an agent, so typing "@iris hello" left it showing. Enter then accepted the highlighted suggestion (a no-op once the name is complete) and returned without sending; the message only went on a second Enter. The list now shows only while the cursor is still inside the leading @-token, so Enter sends as soon as the message has started.
This commit is contained in:
parent
4f75e2a71a
commit
3a7272bdfb
1 changed files with 6 additions and 4 deletions
|
|
@ -353,10 +353,12 @@ import { epochSec } from "./util.js";
|
||||||
}
|
}
|
||||||
function updateSuggest() {
|
function updateSuggest() {
|
||||||
const v = input.value;
|
const v = input.value;
|
||||||
// Only suggest when an @-token sits at the very start of the
|
// Only suggest while the cursor is still inside the @-token at the
|
||||||
// input — switching recipient is always "redirect this whole
|
// very start of the input — switching recipient is always "redirect
|
||||||
// line." Mid-message @-mentions stay literal.
|
// this whole line." Once whitespace follows the token the recipient
|
||||||
const m = v.match(/^@(\S*)/);
|
// is chosen: the list must close, or it swallows the Enter that
|
||||||
|
// should send. Mid-message @-mentions stay literal.
|
||||||
|
const m = v.match(/^@(\S*)$/);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
hideSuggest();
|
hideSuggest();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue