Files
Febe/src/Febe.Browser/Gestures/SearchKeyMap.cs
T
Alby96andClaude Opus 5.5 9941a2fa1f
verifica / controlli (push) Successful in 20s
verifica / prove (push) Failing after 19m40s
verifica / installatore (push) Skipped
verifica / immagine (push) Skipped
Ricerca dei profili con suggerimenti e foto (#37)
«Aggiungi account» ha una sola casella: mentre Alberto scrive compaiono
subito i suggerimenti locali, poi i profili di Instagram con la foto, come
chiesto in #37. Il browser di Febe scrive nella casella «Cerca» di Instagram
con tasti veri da una mappa chiusa (mai Invio, Tab o Esc), controlla prima
il fuoco, legge la risposta della pagina e non clicca mai un risultato.

La ricerca ha una categoria propria nel Governatore, con tetti larghi che
non consumano quelli della raccolta, e si dà il turno con il motore
sull'unica pagina; a fine sessione la pagina torna comunque al riposo. Le
foto passano dal CDN con un permesso ciascuna e restano solo in memoria.

Le risposte di Alberto del 15 novembre (controllo del fuoco, turni, evento
requestWillBeSent, niente foto dei seguiti per ora) sono in §6.1 e in
docs/decisioni.md. Su Instagram vero la ricerca parte quando i bersagli
search-open e search-box saranno raccolti dal vivo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:30:03 +01:00

49 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Globalization;
namespace Febe.Browser.Gestures;
/// <summary>
/// The closed key map of the profile search (issue #37): the only characters Febe may type into the site's search
/// box, each with its full key stroke. Letters a–z, digits, «.», «_» (Shift and Minus, with a real Shift key) and the
/// space. There is no path to Enter, Tab or Escape: <see cref="Keyboard.ForText"/>, which maps a line break to Enter,
/// is never used by the search.
/// </summary>
public static class SearchKeyMap
{
/// <summary>The stroke for <paramref name="c"/>, or null when the search may not type it.</summary>
public static KeyStroke? For(char c)
{
var text = c.ToString(CultureInfo.InvariantCulture);
return c switch
{
>= 'a' and <= 'z' => new KeyStroke(text, "Key" + char.ToUpperInvariant(c).ToString(CultureInfo.InvariantCulture), char.ToUpperInvariant(c), KeyModifiers.None, text),
>= '0' and <= '9' => new KeyStroke(text, "Digit" + text, c, KeyModifiers.None, text),
'.' => new KeyStroke(".", "Period", 190, KeyModifiers.None, "."),
'_' => new KeyStroke("_", "Minus", 189, KeyModifiers.Shift, "_"),
' ' => new KeyStroke(" ", "Space", 32, KeyModifiers.None, " "),
_ => null,
};
}
/// <summary>True when every character of <paramref name="text"/> is in the map.</summary>
public static bool CanType(string text)
{
ArgumentNullException.ThrowIfNull(text);
foreach (var c in text)
{
if (For(c) is null)
{
return false;
}
}
return true;
}
/// <summary>Backspace: the only key the search uses to erase.</summary>
public static KeyStroke Backspace { get; } = Keyboard.Special(SpecialKey.Backspace);
/// <summary>End: the only key the search uses to move the caret.</summary>
public static KeyStroke End { get; } = Keyboard.Special(SpecialKey.End);
}