• Login
Community
  • Login

Writing from right to left

Scheduled Pinned Locked Moved General Discussion
8 Posts 5 Posters 1.2k Views
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.
  • H
    Heidi Holappa
    last edited by Feb 16, 2021, 2:36 PM

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

    P 1 Reply Last reply Feb 16, 2021, 2:49 PM Reply Quote 0
    • P
      PeterJones @Heidi Holappa
      last edited by Feb 16, 2021, 2:49 PM

      @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
      • E
        Ekopalypse
        last edited by Ekopalypse Feb 16, 2021, 3:00 PM Feb 16, 2021, 3:00 PM

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • E
          Ekopalypse
          last edited by Feb 16, 2021, 3:12 PM

          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.

          A H 2 Replies Last reply Feb 16, 2021, 3:20 PM Reply Quote 2
          • A
            Alan Kilborn @Ekopalypse
            last edited by Alan Kilborn Feb 16, 2021, 3:20 PM Feb 16, 2021, 3:20 PM

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

            E 1 Reply Last reply Feb 16, 2021, 3:27 PM Reply Quote 1
            • E
              Ekopalypse @Alan Kilborn
              last edited by Feb 16, 2021, 3:27 PM

              @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
              • H
                Heidi Holappa @Ekopalypse
                last edited by Heidi Holappa Feb 16, 2021, 5:40 PM Feb 16, 2021, 5:39 PM

                @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
                • C
                  Catrin Brooks
                  last edited by Catrin Brooks Jan 31, 2022, 9:00 PM Jan 31, 2022, 8:58 PM

                  This post is deleted!
                  1 Reply Last reply Reply Quote -2
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors