Search Unity

TextMesh Pro TMP input field multi-lines submit mode

Discussion in 'UGUI & TextMesh Pro' started by Gladyon, Jul 12, 2021.

  1. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    I have tried the multi-lines submit mode, and I have been very surprised to see that when you press 'Enter', a carriage return is added where the cursor is before the input is submitted.

    You can see that very clearly by writing a line without any carriage return, go back in the middle, and press 'Enter'.
    Your line will now be one 2 different lines.

    Is that a bug or is it the intended behaviour?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    That is a bug which will be fixed in the next release of the TMP package which I am in the process of finalizing for release.
     
  3. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    Thank you, you fix bugs faster than we create bug reports ;)
     
  4. timbo_unity

    timbo_unity

    Joined:
    Apr 29, 2022
    Posts:
    10
    We're using TMP 3.0.6 - Unity 2021.3.10 LTS.

    When using multline submit mode the submitted text does not contain a break, as expected! But if you clear the text field immediately upon submittion then a line break is injected into the text field.

    OnSubmit.AddListener(_ => inputField.text = string.empty)

    This results in inputField.Text = "\n" by the end of the frame.
     
    wsx578301214 and Beennn like this.