Writing from right to left



  • Hi all,

    I’ve been trying to find a product that provides the option to write characters from right-to-left. By this I mean something different from the available LtR and RtL features. I’d like to have the option to ‘place’ the new symbol to the right side of the cursor, or move the cursor to the left side of the new symbol after placing the symbol.

    The end result would be that when I type the letters “I am a potato” the text editor displays a result of “otatop a ma I”

    I imagine I could achieve this with NotePad++ by using one of it’s plugins and by doing some light coding. I decided to first check here, if anyone has done something like this, or if anyone has good tips on what plugin to use to achieve something like this. Any feedback would be much appreciated.

    The reason I’m looking into this is for writing binary. I’d find it easier to write it in this manner on a computer, and was surprised that there wasn’t an easy to find solution for this (I don’t think I’m the only one who’d prefer this approach from time to time).



  • @Heidi-Holappa ,

    As far as I know, such a plugin doesn’t exist.

    I am not a directional-text expert, but I believe this is because any normal textual entry, whether in LTR, RTL, or BIDI, has the characters get saved in the order you type them, and just presents them according to the LTR/RTL/BIDI settings for the application and the use of unicode directional control sequences.

    But what you are asking for is for the editor to place the characters in the opposite order than you type them, which (as far as I understand it) is not what most people want out of their directional editor.

    Further, I have written binary in big-endian format for years, and I don’t find it difficult to start writing my binary words with typing the MSB first.

    That said, it shouldn’t be too difficult to write a plugin that did it, and probably even easier to write a script in one of the Notepad++ scripting languages (like PythonScript) that did it. If you want to go down that route, my guess is that one of the PythonScript enthusiasts will take on this challenge, because it’s an interesting problem that we haven’t solved yet, but shouldn’t be too difficult.



  • This post is deleted!


  • 2nd try should work

    from Npp import editor, SCINTILLANOTIFICATION
    
    def on_char_added(args):
        if DO_REVERSE_TYPING:
            editor.gotoPos(editor.getCurrentPos()-1)
        
    try:
        DO_REVERSE_TYPING = not DO_REVERSE_TYPING
    except NameError:
        editor.callbackSync(on_char_added, [SCINTILLANOTIFICATION.CHARADDED])
        DO_REVERSE_TYPING = True
    

    The first time the script is run, it is activated, and subsequent calls toggle its state.



  • @Ekopalypse

    Since the OP is interesting in writing binary, perhaps some provision in the script for only doing the reversing when 0 and 1 are entered would be in order?

    I don’t know. This is hard to think about. :-P

    Like Peter, I have been typing binary in conventional order since about the time I started walking, without any sort of problem. So…this is not an issue I’ve considered.



  • @Alan-Kilborn

    This is just one example - at the moment we are not sure if OP even wants to go this way.



  • @Ekopalypse said in Writing from right to left:

    from Npp import editor, SCINTILLANOTIFICATION

    def on_char_added(args):
    if DO_REVERSE_TYPING:
    editor.gotoPos(editor.getCurrentPos()-1)

    try:
    DO_REVERSE_TYPING = not DO_REVERSE_TYPING
    except NameError:
    editor.callbackSync(on_char_added, [SCINTILLANOTIFICATION.CHARADDED])
    DO_REVERSE_TYPING = True

    Thank you SO much Ekopalypse, this is perfect for my needs at the moment! Does exactly what I was looking for.

    Also, thank you all for the very kind and warm replies. This was my first post here and this experience gave a very welcoming feel of the NotePad++ - community.


Log in to reply