Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for odd Cursor behavior #7371

Merged
merged 27 commits into from
Jul 8, 2022
Merged

Fix for odd Cursor behavior #7371

merged 27 commits into from
Jul 8, 2022

Conversation

SotoiGhost
Copy link
Contributor

@SotoiGhost SotoiGhost commented May 20, 2022

Description of Change

This PR brings the following fixes on iOS, Mac, and Android:

  • Text is no longer transformed when IsPassword is enabled
  • Cursor does not longer make orbital jumps to the beginning or the end of an Entry/Editor control when:
    • The text is transformed
    • A Converter is used
    • Or a combination of the above
  • Entry/Editor CursorPosition and SelectedLength properties are now in harmony with its Platform properties and viceversa
  • Entry/Editor CursorPosition and SelectedLength are no longer overridden at Init stage

For Windows:

  • Entry/Editor CursorPosition and SelectedLength properties are now limited to Text.Length
  • Enabled the Editor and Entry Core.DeviceTests.
  • Fixed a scenario where the cursor jumps to the beginning of the Entry/Editor when IsPassword is set
  • Fixed a NRE when Keyboard property is not set

Issues Fixed

@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 20, 2022
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@hartez
Copy link
Contributor

hartez commented Jun 14, 2022

@SotoiGhost This needs to be retargeted to the net6.0 branch if we're going to put it in sr2.

@devonuto
Copy link

@SotoiGhost how is this going? This issue is a bit of a blocker for me. Is there anything we can do to help get it through?

Israel Soto and others added 17 commits July 7, 2022 16:42
…ew and VirtualView

* Fixed for Entry and Editor control
* Enhanced logic to update the CursorPosition when setting a text
* Fixed odd cursor position value caused by text being tranformed by Converters
* Moved to the Platform.TextBox extension methods, so this fix can be applied to any subclass of TextBox
* Fixed where the CursorPosition could become negative
* Add the default TextBox Keyboard when Editor.Keyboard is null
@SotoiGhost
Copy link
Contributor Author

@devonuto Sorry for the late reply, I missed your post. This PR was ready yesterday and hope to be reviewed by the following week.

@SotoiGhost
Copy link
Contributor Author

The following tests are failing on CI but are unrelated to these PR changes:

  • UpdatingSourceUpdatesImageCorrectly

@devonuto
Copy link

devonuto commented Jul 8, 2022

@devonuto Sorry for the late reply, I missed your post. This PR was ready yesterday and hope to be reviewed by the following week.

No worries. Looks like it's still failing a couple of checks. Will that stop it?

Copy link
Contributor

@hartez hartez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just a concern about the casting in the connect/disconnect methods.


if (!_set)
// TODO: NET7 issoto - Remove the casting once we can set the TPlatformView generic type as MauiAppCompatEditText
((MauiAppCompatEditText)PlatformView).SelectionChanged += OnSelectionChanged;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all these direct casts should be if(PlatformView is MauiAppCompatEditText editText); if someone has previously subclassed EntryHandler and overridden CreatePlatformView to use a different AppCompatEditText subclass, then the cast to MauiAppCompatEditText will fail at runtime.

@hartez hartez merged commit c6865a2 into dotnet:net6.0 Jul 8, 2022
@devonuto
Copy link

@hartez @SotoiGhost I take it this merge didn't make it into 6.0.7?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.419 Look for this fix in 6.0.419! legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor platform/android 🤖 platform/iOS 🍎 platform/windows 🪟 t/bug Something isn't working
Projects
None yet
6 participants