Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Writing from right to left

    General Discussion
    5
    8
    382
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Heidi Holappa
      Heidi Holappa last edited by

      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).

      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones @Heidi Holappa last edited by

        @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.

        1 Reply Last reply Reply Quote 1
        • Ekopalypse
          Ekopalypse last edited by Ekopalypse

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • Ekopalypse
            Ekopalypse last edited by

            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.

            Alan Kilborn Heidi Holappa 2 Replies Last reply Reply Quote 2
            • Alan Kilborn
              Alan Kilborn @Ekopalypse last edited by Alan Kilborn

              @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.

              Ekopalypse 1 Reply Last reply Reply Quote 1
              • Ekopalypse
                Ekopalypse @Alan Kilborn last edited by

                @Alan-Kilborn

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

                1 Reply Last reply Reply Quote 1
                • Heidi Holappa
                  Heidi Holappa @Ekopalypse last edited by Heidi Holappa

                  @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.

                  1 Reply Last reply Reply Quote 3
                  • Catrin Brooks
                    Catrin Brooks Banned last edited by Catrin Brooks

                    This post is deleted!
                    1 Reply Last reply Reply Quote -2
                    • First post
                      Last post
                    Copyright © 2014 NodeBB Forums | Contributors