Paste as collapsed

Paste as collapsed

3
NewbieNewbie
3

    Oct 16, 2009#1

    I'm editing an xml document.
    I copy a collapsed section of text.
    When I paste, it pastes expanded.
    I would like it to paste as collapsed.
    It this possible?

    6,675585
    Grand MasterGrand Master
    6,675585

      Oct 17, 2009#2

      I think, NO, it is not possible to paste a block collapsed. But you could write a script and assign a hotkey or chord to it for pasting a text and collapse (hide) the pasted text immediately.

      The script is very simple and therefore I have quickly written it.

      Code: Select all

      // Is any file open and clipboard contains data?
      if (UltraEdit.document.length > 0 && UltraEdit.clipboardContent.length > 0) {
         UltraEdit.insertMode();
         // Store the number of the active line and paste the clipboard content.
         var nStartLine = UltraEdit.activeDocument.currentLineNum;
         UltraEdit.activeDocument.paste();
         // Get the number of the line after paste.
         var nEndLine = UltraEdit.activeDocument.currentLineNum;
         // Are at least 2 lines pasted in insert mode?
         if ((nEndLine - nStartLine) > 1) {
            // If the cursor is now not at start of a line, the clipboard content
            // does not end with a line ending. Therefore insert a line ending at
            // end of the file or set the cursor to start of the next line.
            var nActColNum = UltraEdit.activeDocument.currentColumnNum;
            if (typeof(UltraEdit.activeDocumentIdx) == "undefined") nActColNum++;
            if (nActColNum != 1) {
               if (UltraEdit.activeDocument.isEof()) {
                  UltraEdit.activeDocument.insertLine();
               } else {
                  UltraEdit.activeDocument.gotoLine(++nEndLine,1);
               }
            }
            // Select the pasted block again and collapse it.
            UltraEdit.activeDocument.gotoLineSelect(nStartLine,1);
            UltraEdit.activeDocument.hideOrShowLines();
            // Set the cursor back to position after the pasted block.
            UltraEdit.activeDocument.gotoLine(nEndLine,1);
         }
      }
      Best regards from an UC/UE/UES for Windows user from Austria