mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 02:43:16 +08:00
Merge pull request #25286 from frenzibyte/search-text-box-select-all
Automatically select existing search text when opening settings
This commit is contained in:
commit
3060cf1438
@ -10,7 +10,7 @@
|
|||||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1012.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1030.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||||
|
@ -140,6 +140,17 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
AddUntilStep("top-level textbox focused", () => settings.SectionsContainer.ChildrenOfType<FocusedTextBox>().FirstOrDefault()?.HasFocus == true);
|
AddUntilStep("top-level textbox focused", () => settings.SectionsContainer.ChildrenOfType<FocusedTextBox>().FirstOrDefault()?.HasFocus == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSearchTextBoxSelectedOnShow()
|
||||||
|
{
|
||||||
|
SearchTextBox searchTextBox = null!;
|
||||||
|
|
||||||
|
AddStep("set text", () => (searchTextBox = settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First()).Current.Value = "some text");
|
||||||
|
AddAssert("no text selected", () => searchTextBox.SelectedText == string.Empty);
|
||||||
|
AddRepeatStep("toggle visibility", () => settings.ToggleVisibility(), 2);
|
||||||
|
AddAssert("search text selected", () => searchTextBox.SelectedText == searchTextBox.Current.Value);
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
@ -135,7 +135,7 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Child = searchTextBox = new SeekLimitedSearchTextBox
|
Child = searchTextBox = new SettingsSearchTextBox
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
|
22
osu.Game/Overlays/SettingsSearchTextBox.cs
Normal file
22
osu.Game/Overlays/SettingsSearchTextBox.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays
|
||||||
|
{
|
||||||
|
public partial class SettingsSearchTextBox : SeekLimitedSearchTextBox
|
||||||
|
{
|
||||||
|
protected override void OnFocus(FocusEvent e)
|
||||||
|
{
|
||||||
|
base.OnFocus(e);
|
||||||
|
|
||||||
|
// on mobile platforms, focus is not held by the search text box, and the select all feature
|
||||||
|
// will not make sense on it, and might annoy the user when they try to focus manually.
|
||||||
|
if (HoldFocus)
|
||||||
|
SelectAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -36,7 +36,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="11.5.0" />
|
<PackageReference Include="Realm" Version="11.5.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2023.1012.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2023.1030.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1023.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1023.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.40.0" />
|
<PackageReference Include="Sentry" Version="3.40.0" />
|
||||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1012.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1030.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user