How to use tag list with multi-select/multi-caret?

How to use tag list with multi-select/multi-caret?

4
NewbieNewbie
4

    Mar 30, 2015#1

    I'm a big fan of my tag list, and use them for all sorts of formatting and code snippets. It seems that when I do a multi-select throughout the document, and double click on a tag to apply to selections, it only applies to the last select made. Is there a setting that needs to be changed to allow all selections to be "tagged" at once. If it's not possible, then I think it should be a requested feature. It would be very useful.

    6,675585
    Grand MasterGrand Master
    6,675585

      Mar 31, 2015#2

      A smart template is applied to all selections on inserting a smart template. But a tag list item or HTML toolbar item is applied only on last selected text in UE v22.00.0.46.

      So I can only suggest to send a feature request email to IDM support for enhancing tag list and HTML toolbar feature also for multi-caret respectively multi-select mode.

      Of course you could also convert your tag list(s) to smart template list(s). The tag list file is a text file and a smart template file is an XML file. So it would be possible with some tagged regular expressions to convert a tag list into a smart template XML file. I could record the regular expression replaces needed for this conversion into a macro if you are interest in.
      Best regards from an UC/UE/UES for Windows user from Austria

      4
      NewbieNewbie
      4

        Mar 31, 2015#3

        I would be interested in that macro. I guess I need to learn about smart templates. I've never used them. Thank you for your reply!

        6,675585
        Grand MasterGrand Master
        6,675585

          Apr 01, 2015#4

          In the attached ZIP file is the macro file TagsToTemplates.mac with first version of the macro to convert a tag list to a template file. The source code of the macro with some comments is also included in file TagsToTemplates.uem.

          To use that macro do following:
          1. Open with View - Views/Lists - Tag List the tag list view if not already visible.
          2. Right click into the tag list view and left click on context menu item Modify Tags.
          3. Select the name of the tag list file with complete path and press Ctrl+C to copy it. Close the dialog with button Cancel.
          4. Press Ctrl+O and insert with Ctrl+V the copied file name with path into the file name edit field. Open the file with button Open.
          5. Select a tag list, i.e. the lines starting with 0="..." to last line of current tag list.
            Do not select multiple tag lists. The macro is written to convert just one tag list to a template file on each execution.
          6. Copy the selected tag list with Ctrl+C, Ctrl+N and Ctrl+V into a new file.
          7. Use Macro - Load to load the macro file TagsToTemplates.mac.
          8. Execute the macro with Macro - Play Again.
          You see now a templates file with tag description being used as template name and template description.

          It is usually advisable to use as template name a string consisting only of [A-Za-z0-9_] for being able to easily use feature auto-suggest smart template when typing.

          However, the template file is already ready for being used with View - Views/Lists - Template List.

          The created template file must be saved by user now as
          • UETMPLTE.TPL for usage as global templates in the templates folder, or
          • environment.tp1 respectively layout.tp1 for usage as environment/layout templates, or
          • language-tpl.xml for usage as language templates.
          See the topic smart templates management for more details on templates management and where the template files are stored depending on configuration.

          A restart of UltraEdit is necessary to see the templates in just stored template file in the template list view.
          TagsToTemplates.zip (3.04 KiB)   84
          This ZIP file contains first version of macro file with source code file to convert a tag list to a templates file.
          Best regards from an UC/UE/UES for Windows user from Austria

          4
          NewbieNewbie
          4

            Apr 01, 2015#5

            Thanks for your detailed instructions. I've been using UE for about 10 years now, but there's still a lot to it that I've never played with. And they keep adding new features that I'm not aware of. :-) This will integrate nicely into my workflow.

              Apr 01, 2015#6

              Well, it turns out that this doesn't work as I'd hoped. I'll give a very simple example of what I hoped this would do:

              Code: Select all

              item 1: blah blah blah
              item 2: blah blah blah
              item 3: blah blah blah
              
              I have a template that would put a <strong></strong around whatever selection I have. So by selecting all things I wanted tagged (in this case, the text for item 1:, item 2: and item 3:), I could just run the template and get this:

              Code: Select all

              <strong>item 1:</strong> blah blah blah
              <strong>item 2:</strong> blah blah blah
              <strong>item 3:</strong> blah blah blah
              
              But in practice, it takes the last thing selected and uses it to [$replace$] the others:

              Code: Select all

              <strong>item 3:</strong> blah blah blah
              <strong>item 3:</strong> blah blah blah
              <strong>item 3:</strong> blah blah blah
              
              Any way around this?

              6,675585
              Grand MasterGrand Master
              6,675585

                Apr 01, 2015#7

                Good gracious! You are right!

                I'm not using multi-caret and multi-select feature by myself as I do such modifications always with using replace command. So I enabled just that feature, made two selections, applied one of my templates and saw that the template strings (A element) was inserted around both selections before I posted first reply. But I did not look on the strings which should be kept unmodified.

                You are right that the last selected string is used on inserting the template at all positions. That does not make sense and makes the smart templates feature less useful for multi-caret editing, especially for inserting tags in HTML, XHTML and XML files at multiple locations at once.

                Please report this issue by email to IDM support as I have done, too. This must be fixed by a developer of UltraEdit. There is nothing a user like you and me can change here.
                Best regards from an UC/UE/UES for Windows user from Austria