extra space added at front of phrase when pasting

Ross's Avatar

Ross

17 Jan, 2020 07:07 PM

When I paste a Japanese phrase into my "Expression" field or an English phrase into my "Reading" field and extra space always appears at the beginning of the phrase. I don't want this to happen but can't seem to find the cause.
I use the "Japanese Support" add-on, hence the field names. When the add-on generates the "Reading" field, there is no added space. I tried disabling the add-on (holding shift down while starting Anki) but this had no effect (other than not generating the "Reading" field).
There doesn't seem to be an extra space in the template for these fields, though finding and empty space is kind of difficult.
Pasting Japanese or English phrases when using the mobile app does not result in this problem.
Do you have any suggestions on what I can do next to search for the cause.
Cheers

  1. Support Staff 1 Posted by Damien Elmes on 18 Jan, 2020 12:03 AM

    Damien Elmes's Avatar

    If you press ctrl+shift+x to reveal the HTML of the field, what does it show?

  2. 2 Posted by Ross on 18 Jan, 2020 01:08 AM

    Ross's Avatar

    Hi,
    Sorry if this does not appear above the line. For some reason my gmail
    doesn't seem to allow that.
    When I type that before I paste anything into the Expression field, the
    HTML Editor screen shows nothing. When I paste a kanji in, the following
    appears,

    <div>&nbsp;査</div>

    Similarly for the Reading field: nothing then <div>&nbsp;add to some
    existing</div>

    Hope this helps point toward a solution.

    Ross

  3. Support Staff 3 Posted by Damien Elmes on 18 Jan, 2020 09:19 PM

    Damien Elmes's Avatar

    Have you tried pasting from somewhere else? I don't see the nbsp here, and it may be coming from your source material.

  4. 4 Posted by Ross on 19 Jan, 2020 01:33 AM

    Ross's Avatar

    Hi, thank you for your suggestion. It seems to be right on the mark.
    I checked various types of files with cut and paste into Anki “Add”.
    I use Linux and the following applies to my Linux versions:
          LibreOffice Writer adds the extra space at the beginning.
          LibreOffice Calc does NOT add the extra space.
          As would be expected copy/pasting from a txt (text) file does not add the extra space.
    Thank you very much for your continued great help.
    Ross

  5. Support Staff 5 Posted by Damien Elmes on 19 Jan, 2020 07:42 AM

    Damien Elmes's Avatar

    Hi Ross,

    It appears to be an interaction between the way Anki clears formatting and the text that LibreOffice outputs. You can paste with the shift key in your Anki version to fix it, or update to Anki 2.1.19 where that is the default.

Comments are closed, but you can start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac