User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

This forum is user-to-user based and not regularly monitored by IDM.
Please see technical support page on how to contact IDM.
2 posts Page 1 of 1
Dear Community:

I saw this discussion thread in 2005 and would like to know: Is there a solution in the current version of UltraEdit Professional Text/HEX Editor Version I want to collapse tags that are at the same level instead of going one by one which is really disgusting/boring and tiring.

Thanks in advanced.

There is no built-in command to collapse all based on folding level in UE v21.10.0.1032 which I think would be a nice feature.

Such a feature could be implemented with an UltraEdit script for certain languages if the active file is well indented. Here is an example for such a script quickly written because of your question.

Code: Select all
if (UltraEdit.document.length > 0)  // Is any file opened?
   // Define environment for this script.

   // Remember current position of caret in the file.
   var nLine = UltraEdit.activeDocument.currentLineNum;
   var nColumn = UltraEdit.activeDocument.currentColumnNum;
   var sIndent = "";

   // Move caret to column 1 in current line.
   // Select the whitespaces at beginning of this line.
   // Nothing is selected if caret is currently on a blank line.
   if (UltraEdit.activeDocument.isSel())
      // Get the selected indent (= selected "word").
      var sIndent = UltraEdit.activeDocument.selection;
      // Is really an indent or a word selected?
      if (\S/) >= 0) sIndent = "";
   // Move caret to top of the active file.;

   // For C/C++/C# and JavaScript the open fold string is an open brace.
   var sFold = "%" + sIndent + "{";

   // Define the parameters for an UltraEdit regular expression search.
   if (typeof(UltraEdit.activeDocument.findReplace.searchInColumn) == "boolean")

   // Fold all blocks with an opening brace at current indentation level.
   // Block comments are not folded with this scripting code.
      UltraEdit.activeDocument.key("DOWN ARROW");
   // Move caret back to initial position on script start.

Note: This script does not work for C/C++/C# or JavaScript files using styles like java attach, Kernighan & Ritchie, stroustrup, banner, linux, otbs or lisp as explained on help page with title Artistic Style Formatter dialog. Such coding styles would require a much smarter UltraEdit script.
Best regards from Austria
2 posts Page 1 of 1