• Login
Community
  • Login

Автоматический перенос строки

Scheduled Pinned Locked Moved General Discussion
29 Posts 5 Posters 8.9k 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.
  • V
    Vio Ru
    last edited by Mar 10, 2020, 8:34 PM

    Уважаемые друзья! Возможно ли реализовать автоматический перенос на начало строки после вставки& Например, вставил какой-либо текст или ссылку и курсор автоматом встаёт в начало следующей строки, без нажатия Enter

    Благодарю, с уважением

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by Mar 10, 2020, 9:01 PM

      @Vio-Ru

      Dear friends! Is it possible to implement automatic wrapping to the beginning of a line after insertion & For example, I inserted some text or a link and the cursor automatically goes to the beginning of the next line, without pressing Enter
      Thank you respectfully

      Exactly as you describe? Probably not. “Inserted some text” is a nebulous concept, and could be done via typing or pasting or other means. How would Notepad++ be expected to know when your “insert” is done, so that it can automatically put in a line break.

      It would be possible to define a macro that would paste the contents of the clipboard, then automatically type the newline sequence (CRLF) for you.

      1. Close all active Notepad++ and open one instance
      2. Open the file %AppData%\Notepad++\shortcuts.xml
      3. in the <Macros> section, add the following lines:
              <Macro name="PasteEnter" Ctrl="no" Alt="no" Shift="no" Key="0">
                  <Action type="0" message="2179" wParam="0" lParam="0" sParam="" /><!-- paste -->
                  <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x000D;&#x000A;" /><!-- type CRLF -->
              </Macro>
      
      1. save, exit Notepad++, and reload
      2. Now Macro > PasteEnter will paste the current clipboard and type a newline for you.
      3. If you want to assign that to a keyboard shortcut, you can use Macro > Modify Shortcut/Delete Macro…, select the PasteEnter row, and change the shortcut for it. From then on, using that keyboard shortcut instead of the normal paste (Ctrl+V) will do what you want.

      If you don’t just want it on Paste, but anytime you are typing text, using Settings > Preferences > Editing and setting the Vertical Edge Settings will allow you turn it on so Notepad++ will wrap after 80 characters (or whatever you set it to).

      Other than those, I’m not sure how else to accomplish what you want.

      I will use Google Translate to translate my reply from English to Russian, but I have no idea as to the quality of that translation. The standard language of this forum is English.

      ----
      Точно, как вы описываете? Возможно нет. «Вставленный текст» является туманным понятием, и его можно выполнить с помощью набора текста, вставки или других средств. Как Notepad ++ должен знать, когда ваша «вставка» завершена, чтобы он мог автоматически вставлять разрыв строки.

      Можно было бы определить макрос, который вставит содержимое буфера обмена, а затем автоматически наберет последовательность новой строки (CRLF).

      1. Закройте все активные Notepad ++ и откройте один экземпляр
      2. Откройте файл % AppData% \ Notepad ++ \ shortcuts.xml
      3. в разделе «<Macros>» добавьте строки из раздела «английский»:
      4. сохранить, выйти из Notepad ++ и перезагрузить
      5. Теперь ** Macro> PasteEnter ** вставит текущий буфер обмена и наберет новую строку для вас.
      6. Если вы хотите назначить это сочетанию клавиш, вы можете использовать ** Macro> Изменить ярлык / Удалить макрос … **, выбрать строку PasteEnter и изменить для нее ярлык. С тех пор использование этого сочетания клавиш вместо обычной вставки (Ctrl + V) будет делать то, что вы хотите.

      Если вы хотите не просто вставить его, а в любое время набирать текст, [используя ** Настройки> Настройки> Редактирование **] (https://npp-user-manual.org/docs/preferences/#editing) а установка ** Vertical Edge Settings ** позволит вам включить его, чтобы Notepad ++ переносился после 80 символов (или любого другого значения).

      Кроме тех, я не уверен, как еще выполнить то, что вы хотите.

      Я буду использовать Переводчик Google, чтобы перевести мой ответ с английского на русский, но я не имею представления о качестве этого перевода. Стандартный язык этого форума - английский.

      G 1 Reply Last reply Mar 13, 2021, 8:37 AM Reply Quote 4
      • V
        Vio Ru
        last edited by Mar 11, 2020, 11:03 AM

        Спасибо за ответ! Нужно именно после вставки из буфера обмена, то есть - вставил из буфера и Notepad перенёс курсор на новую строку. Длина текста в буфере обмена может быть любой

        G 1 Reply Last reply Mar 13, 2021, 8:08 AM Reply Quote 1
        • P
          PeterJones
          last edited by Mar 11, 2020, 1:02 PM

          @Vio-Ru said,

          Thanks for the answer! It is necessary after pasting from the clipboard, that is, pasted from the clipboard and Notepad moved the cursor to a new line. The length of the text on the clipboard can be any

          If you want the newline after pasting from the clipboard, then the macro I showed should work for you.

          @PeterJones said,

          [original phrasing by @Vio-Ru]: вставил какой-либо текст
          [English version]: “Inserted some text”
          [Translated to Russian]: «Вставленный текст»
          [Translated back to English]: “Pasted text”

          Looking at the translation of my translation, apparently “pasted text” and “inserted some text” are closer in Russian than they are in English.
          0b1df9a9-0987-479a-a729-0778d6994dfb-image.png
          53bdd079-570d-4268-b534-c95d21feee90-image.png

          I was misinterpreting the auto-English translation of “вставил какой-либо текст”, which was shown to me as “inserted some text”, as “inserted [by typing] some text”, rather than the “inserted [by pasting from the clipboard] some text” that was apparently meant. Sorry for the lingual confusion.

          1 Reply Last reply Reply Quote 1
          • V
            Vio Ru
            last edited by Mar 11, 2020, 11:59 PM

            Thank you for answer! But your macros is not working ))
            Here are the screenshots, what I need

            alt text

            alt text

            P 1 Reply Last reply Mar 12, 2020, 1:11 PM Reply Quote 0
            • V
              Vio Ru
              last edited by Mar 12, 2020, 12:10 AM

              12-03-2020 02-47-47.png

              12-03-2020 02-53-21.png

              1 Reply Last reply Reply Quote 0
              • P
                PeterJones @Vio Ru
                last edited by Mar 12, 2020, 1:11 PM

                @Vio-Ru said in Автоматический перенос строки:

                But your macros is not working ))

                Apparently there was confusion (probably a language thing, still), because with the screenshots you showed, you are not using the macro. The macro doesn’t change the normal paste behavior – whether you use Edit > Paste, RightClick > Paste, or Ctrl+V. The macro is a separate command – in the Macro menu – which does both a paste and an enter.

                I will use pictures, in case my words don’t translate well for you.

                You have to use the macro to get the paste-then-enter behavior.

                If you want a keyboard shortcut, like maybe Ctrl+Shift+V, to be used for this paste+enter, you can use Macros > Modify Shortcut / Delete Macro
                429f3b28-9155-4edd-8e44-80024cba92f0-image.png
                Then (1) select PasteEnter, (2) Modify, (3) select keys – I checked Ctrl and Shift, and selected the V, for Ctrl+Shift+V as the keyboard shortcut, (4) OK, (5) CLOSE.
                6603cce7-9def-4709-9686-85eff302d176-image.png
                After this, Ctrl+Shift+V (or whatever key sequence you choose) will run Macro > PasteEnter.

                But without running the PasteEnter macro, you cannot expect the new behavior.

                I hope this makes it clear.

                1 Reply Last reply Reply Quote 2
                • V
                  Vio Ru
                  last edited by Vio Ru Mar 13, 2020, 1:04 PM Mar 13, 2020, 1:04 PM

                  Yes, it works like that. But I need it without additional taps, such as Macros or hot keys. I need to configure it once and then so that at each insert from the buffer the cursor jumps to the next line without using additional clicks.
                  As I understand it, this behavior is impossible to implement.
                  In any case, thank you for your time.

                  P 1 Reply Last reply Mar 13, 2020, 3:13 PM Reply Quote 0
                  • P
                    PeterJones @Vio Ru
                    last edited by Mar 13, 2020, 3:13 PM

                    @Vio-Ru ,

                    But I need it without additional taps, such as Macros or hot keys. I need to configure it once and then so that at each insert from the buffer the cursor jumps to the next line without using additional clicks.

                    There are no additional clicks. There are different clicks. Instead of using Ctrl+V for paste, use whatever shortcut you assign to that macro. It’s really simple, and the same number of keystrokes.

                    In fact, if you always want paste to be paste+enter, you can use shortcut mapper to remove Ctrl+V from normal Paste, and instead assign Ctrl+V to the PasetEnter macro
                    6a1ea07c-1004-4d38-ba7a-360d351c7f0b-image.png

                    Also, if you usually use RightClick > Paste to access the paste function from the context menu, you can also edit the context menu config to give you the option of RightClick > PasteEnter instead, an put it right next to the paste:

                    1. Use Settings > Edit Popup ContextMenu
                    2. Add <Item MenuEntryName="Macro" MenuItemName="PasteEnter"/> immediately after the <Item MenuEntryName="Edit" MenuItemName="Paste"/> line
                    3. save, exit, and reload Notepad++
                    4. Now your RightClick menu will show PasteEnter right after Paste. You can use RClick > PasteEnter anytime you would have used RClick > Paste, with exactly the same amount of effort from now on.

                    So, to sum up:

                    1. if you assign a keyboard shortcut to PasteEnter macro, you can use that anytime you would have used Ctrl+V, with exactly the same number of clicks as a normal Ctrl+V.
                    2. if you assign the Ctrl+V keyboard shortcut to PasteEnter macro, you can use that every time you paste with Ctrl+V, because it will be using that macro instead of the normal just-paste functionality
                    3. if you add the PasteEnter macro to the right click context menu, you can use that entry in the right click context menu exactly as easily as you can use the normal paste from the right click menu.

                    There are many ways to make the Paste+Enter functionality identically-easy to use as the builtin paste functionality. I have shown three right here – including one that replaces Ctrl+V functionality with the new Paste+Enter with the same keystroke. There is no difference in difficulty of long-term use between using PasteEnter macro and using normal Paste – it can be done in the same number of keystrokes (1) or in the same right-click context menu; it’s exactly the same difficulty to use.

                    1 Reply Last reply Reply Quote 2
                    • V
                      Vio Ru
                      last edited by Vio Ru Mar 14, 2020, 2:32 PM Mar 14, 2020, 2:32 PM

                      Thanks a lot, Peter! Everything turned out as I wanted :)

                      1 Reply Last reply Reply Quote 1
                      • G
                        Gena M @Vio Ru
                        last edited by Mar 13, 2021, 8:08 AM

                        @Vio-Ru Добрый день. Мне нужно тоже самое. Я выполнил все действия описанные выше, но в меню Макросов не появился нужный , хотя он прописан в файле, но программа его не видит (( У вас были подобные проблемы?

                        1 Reply Last reply Reply Quote 0
                        • G
                          Gena M @PeterJones
                          last edited by Mar 13, 2021, 8:37 AM

                          @PeterJones Hello! I follow your instruction literaly … Step by step. But I can’t see PasteEnter in Macros menu! I try in 2 computers, but nothing… Please, help! !
                          ![0_1615624589383_Screenshot_1.png](Uploading 100%)
                          ![0_1615624617723_Screenshot_2.png](Uploading 100%)

                          P 1 Reply Last reply Mar 13, 2021, 6:35 PM Reply Quote 0
                          • P
                            PeterJones @Gena M
                            last edited by Mar 13, 2021, 6:35 PM

                            @Gena-M said in Автоматический перенос строки:

                            0_1615624589383_Screenshot_1.png

                            Sorry, your screenshots did not embed properly, so I cannot see what you showed.

                            The procedure I described reliably works for me. So maybe you did something wrong or you missed a step.

                            Please respond to the following questions/requests to help us help you:

                            1. Please share those screenshots again – make sure they show up in the “preview” window in the forum – that will help us understand what you have and what you don’t have
                            2. Please go to the ? menu and Debug Info entry, and copy/paste that information into your reply. This will tell us what version you are using and what directories we should expect files to be in
                            3. Did you create the macro as described in the 6 steps in my first message? Please show us a screenshot of the Macro menu to show that PasteEnter macro was created and saved
                            4. Did you correctly edit the Context Menu (including restarting Notepad++)?

                            Hopefully, we can help you figure out which step went wrong.

                            1 Reply Last reply Reply Quote 0
                            • V
                              Vio Ru
                              last edited by Sep 5, 2023, 5:54 PM

                              In new versions this method does not work, because the developers changed the code in Shortcuts, could you help me set up line wrapping when inserting in a new version of Notepad?

                              P 1 Reply Last reply Sep 5, 2023, 6:01 PM Reply Quote 0
                              • P
                                PeterJones @Vio Ru
                                last edited by Sep 5, 2023, 6:01 PM

                                @Vio-Ru said in Автоматический перенос строки:

                                In new versions this method does not work, because the developers changed the code in Shortcuts,

                                There’s an entire FAQ entry that explains exactly what you need to change to make a macro recorded in an old version to work with v8.5.3. and newer. Follow those instructions, and it will work for you.

                                1 Reply Last reply Reply Quote 0
                                • V
                                  Vio Ru
                                  last edited by Vio Ru Sep 5, 2023, 6:12 PM Sep 5, 2023, 6:07 PM

                                  It didn’t work out for me, that’s why I’m asking for help. I think it’s about, but, what to replace it with, I do not know

                                  05-09-2023 21-08-38.png

                                  P 1 Reply Last reply Sep 5, 2023, 6:24 PM Reply Quote 0
                                  • P
                                    PeterJones @Vio Ru
                                    last edited by PeterJones Sep 5, 2023, 6:51 PM Sep 5, 2023, 6:24 PM

                                    @Vio-Ru said in Автоматический перенос строки:

                                    It didn’t work out for me, that’s why I’m asking for help.

                                    You didn’t actually read and understand the FAQ, or follow its instructions, did you?

                                    I think it’s about, but, what to replace it with, I do not know

                                    That’s because you didn’t read the FAQ.

                                    05-09-2023 21-08-38.png

                                    Yep. The FAQ explains how to fix that underlined section that you showed from shortcuts.xml:

                                    67f4ab04-e6d7-4b23-8131-b3ae083825ca-image.png

                                    So if you have in your macro, you need to run the search-and-replacements listed in the screenshot of the FAQ that I just showed, and then save the shortcuts.xml file, then restart Notepad++. After that, it will work.

                                    1 Reply Last reply Reply Quote 2
                                    • V
                                      Vio Ru
                                      last edited by Sep 5, 2023, 7:02 PM

                                      It just replaces these values & #x0D; & #x0A; Shouldn’t it be the same?

                                      05-09-2023 21-57-31.png

                                      P 1 Reply Last reply Sep 5, 2023, 7:43 PM Reply Quote 0
                                      • P
                                        PeterJones @Vio Ru
                                        last edited by PeterJones Sep 5, 2023, 8:13 PM Sep 5, 2023, 7:43 PM

                                        @Vio-Ru said in Автоматический перенос строки:

                                        It just replaces these values & #x0D; & #x0A;

                                        Yes, that’s what the instructions are supposed to do.

                                        Shouldn’t it be the same?

                                        The same as what? That makes no sense.

                                        But since I cannot seem to teach you how to do this, I will spoon-feed you the answer.

                                        Your macro in shortcuts.xml used to be

                                        <Macro name="PasteEnter" Ctrl="no" Alt="no" Shift="no" Key="0">
                                            <Action type="0" message="2179" wParam="0" lParam="0" sParam="" /><!-- paste -->
                                            <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x000D;&#x000A;" /><!-- type CRLF -->
                                        </Macro>
                                        

                                        Now that same section in shortcuts.xml needs to be

                                        <Macro name="PasteEnter" Ctrl="no" Alt="no" Shift="no" Key="0">
                                            <Action type="0" message="2179" wParam="0" lParam="0" sParam="" /><!-- paste -->
                                            <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x0D;&#x0A;" /><!-- type CRLF -->
                                        </Macro>
                                        

                                        Then save, exit Notepad++, and reload. Now your Macro > PasteEnter will work again.

                                        ----
                                        edit: fixed the forum’s corruption of my intended post

                                        TBugReporterT V 2 Replies Last reply Sep 5, 2023, 8:05 PM Reply Quote 0
                                        • TBugReporterT
                                          TBugReporter @PeterJones
                                          last edited by TBugReporter Sep 5, 2023, 8:09 PM Sep 5, 2023, 8:05 PM

                                          @PeterJones said in Автоматический перенос строки:

                                          Your macro in shortcuts.xml used to be […]

                                          Now that same section in shortcuts.xml needs to be […]

                                          I cut, pasted, and compared your two code snippets twice, and can find no difference between them other than the second one ends with four backquotes instead of three.

                                          P 1 Reply Last reply Sep 5, 2023, 8:11 PM Reply Quote 1
                                          • First post
                                            Last post
                                          The Community of users of the Notepad++ text editor.
                                          Powered by NodeBB | Contributors