Search Unity

TextMesh Pro InputField overwrites same line bug

Discussion in 'UGUI & TextMesh Pro' started by MaZy, Mar 20, 2021.

  1. MaZy

    MaZy

    Joined:
    Jun 29, 2012
    Posts:
    105
    Hello the following gif shows the bug. If I click behind a word it will write correctly what I type. If I click little bit far away (you see the cursor more at the right side) then suddently it will overwrite the line. Why this happens? How could I fix this?

     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Is this a single TMP Input Field or multiple input fields?

    What version of the TMP package are you using?

    Any chance you can provide me with a repro project of this? This would make it much easier to figure out why you are getting this behavior.
     
  3. MaZy

    MaZy

    Joined:
    Jun 29, 2012
    Posts:
    105
    @Stephan_B
    I use the 3.0.4 Version.
    This is only one TMP Input Field. The second is top right where you see the ControlExample.

    No sadly I cannot provide project.

    But I noticed something. The text editor can save or load files from my computer. All files which has CRLF causes the problem


    But if there is only LF then it there is no problem.



    Example the line 4 does the problem ingame too but not the line 5.

    Here is the example of the small code. You will see I am loading the CosSinExample in the video and there I will show line 5 and 4


    EDIT: Yep its confirmed. If I do textContent = textContent.Replace("\r\n", "\n"); the problem get fixed.
     
    Last edited: Mar 22, 2021
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Asking about the text potentially containing CR without LF at the end of the line was going to be my next pointer if you were using a single input field.

    CR or Carriage Return is designed to return the caret back to the start of the line. Without a LF or Line Feed this results in the text being written on top of existing text on that line. Just like you would get on a type writer in the old days.
     
    MaZy likes this.
  5. MaZy

    MaZy

    Joined:
    Jun 29, 2012
    Posts:
    105
    What do you mean with single input field? One component or do you mean the Line Type like Multi Line Newline. If the last is yes so I am using Multi Line Newline.

    So it doesn't count as bug and should care myself about it?

    Indeed I saved few content of the input field in runtime and some were written on windows itself (via notepad++).
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I meant multiple text input field components.

    Not a bug as the behavior is exactly how a <CR> should be have without <LF>. There are users that use <CR> for that specific functionality.

    In terms of the <CR> without <LF> this is pretty common when copy pasting from web pages.