Community
    • Login

    [Feature request] right-to-left editing for each tab

    Scheduled Pinned Locked Moved General Discussion
    10 Posts 3 Posters 856 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.
    • maimonid toledanoM
      maimonid toledano
      last edited by

      Currently, the CONTROL-ALT-R/L enable right to left or left to right editing globally: all the opened tabs are affected by the control at once. As a person that has to write in both English and Hebrew very often, I can tell you this is highly undesirable. The left-to-right/left controls MUST be tab independent, for you have very often documents in English opened in one tab, and another document in Arab, Hebrew etc. opened in another tab. For global behavior, nothing prevents to add a default control in the preference menu if desired, but I think this is far less important.

      Terry RT 1 Reply Last reply Reply Quote 0
      • Terry RT
        Terry R @maimonid toledano
        last edited by

        @maimonid-toledano

        There was a discussion on this recently, see this post.

        It also links to a github post which is where feature requests are made in order to get the developers attention.

        Not sure there has been much movement though to date.

        I suggest you add your weight to that github post.

        Terry

        maimonid toledanoM 1 Reply Last reply Reply Quote 0
        • maimonid toledanoM
          maimonid toledano @Terry R
          last edited by maimonid toledano

          @Terry-R Don’t find the link to Github. Could you add a link to the github post?

          Terry RT 1 Reply Last reply Reply Quote 0
          • Terry RT
            Terry R @maimonid toledano
            last edited by

            @maimonid-toledano
            You didn’t read the entire thread, it’s in one of the posts in that thread

            Terry

            maimonid toledanoM 1 Reply Last reply Reply Quote 0
            • maimonid toledanoM
              maimonid toledano @Terry R
              last edited by maimonid toledano

              @Terry-R Finally found it. OK I’ve added a comment there.

              Alan KilbornA 1 Reply Last reply Reply Quote 0
              • Alan KilbornA
                Alan Kilborn @maimonid toledano
                last edited by

                @maimonid-toledano

                Another link where this has been discussed before: https://community.notepad-plus-plus.org/topic/21701/keep-rtl-ltr-per-tab

                This (RTL) is a specific attribute of a more general lack in Notepad++: per tab settings

                The most common per-tab request is that “word wrap” be non-global and apply to the file tabs individually – that way a user could have certain tabs (e.g. their C++ source code) non-line-wrapped, and other tabs (e.g. maybe their .txt files with notes about their source code) line-wrapped like a word-processor would do.

                maimonid toledanoM 1 Reply Last reply Reply Quote 2
                • maimonid toledanoM
                  maimonid toledano @Alan Kilborn
                  last edited by

                  @Alan-Kilborn
                  thx. You said there you can control some of these things with Python-script plugin. Could you indicate me how you do that?

                  Alan KilbornA 1 Reply Last reply Reply Quote 0
                  • Alan KilbornA
                    Alan Kilborn @maimonid toledano
                    last edited by

                    @maimonid-toledano

                    It could be done via scripting for RTL like I show HERE for wrapping.

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

                      Here’s an example of a possible script:

                      # -*- coding: utf-8 -*-
                      
                      # references:
                      #  https://community.notepad-plus-plus.org/topic/24849/
                      
                      from Npp import *
                      
                      #-------------------------------------------------------------------------------
                      
                      class TDTFAT(object):
                      
                          def __init__(self):
                              self.rtl_by_buffer_id_dict = {}
                              notepad.callback(self.bufferactivated_callback, [NOTIFICATION.BUFFERACTIVATED])
                      
                          def bufferactivated_callback(self, args):
                              bid = args['bufferID']
                              menu_cmd = MENUCOMMAND.EDIT_LTR
                              if bid in self.rtl_by_buffer_id_dict and self.rtl_by_buffer_id_dict[bid] == 1: menu_cmd = MENUCOMMAND.EDIT_RTL
                              notepad.menuCommand(menu_cmd)
                      
                          def toggle_text_direction_mode(self):
                              bid = notepad.getCurrentBufferID()
                              if bid in self.rtl_by_buffer_id_dict:
                                  self.rtl_by_buffer_id_dict[bid] = 1 if self.rtl_by_buffer_id_dict[bid] == 0 else 0  # toggle
                              else:
                                  self.rtl_by_buffer_id_dict[bid] = 1  # turn rtl on for current file
                              notepad.menuCommand(MENUCOMMAND.EDIT_RTL if self.rtl_by_buffer_id_dict[bid] else MENUCOMMAND.EDIT_LTR)
                              self.sb_output('Text direction is {} for active tab'.format('RTL' if self.rtl_by_buffer_id_dict[bid] else 'LTR'))
                      
                          def sb_output(self, *args):  # output to N++'s status bar (will be overwritten by N++ e.g. when active tab is changed)
                              notepad.setStatusBar(STATUSBARSECTION.DOCTYPE, ' '.join(map(str, args)))
                      
                      #-------------------------------------------------------------------------------
                      
                      # to run via another file, e.g., startup.py, put these lines (uncommented and unindented) in that file:
                      #  import TextDirectionToggleForActiveTab
                      #  tdtfat = tdtfat.TDTFAT()
                      
                      # when this script is run interactively, it will toggle the text direction setting on the currently active tab
                      
                      if __name__ == '__main__':
                          try:
                              tdtfat
                          except NameError:
                              tdtfat = TDTFAT()
                          tdtfat.toggle_text_direction_mode()
                      

                      For newbie info on PythonScripts, see https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript

                      maimonid toledanoM 1 Reply Last reply Reply Quote 2
                      • Alan KilbornA Alan Kilborn referenced this topic on
                      • maimonid toledanoM
                        maimonid toledano @Alan Kilborn
                        last edited by

                        @Alan-Kilborn Thank you Alan. I will try it.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors