Comment Remove is slow, how to remove line comments faster?

Comment Remove is slow, how to remove line comments faster?

6
NewbieNewbie
6

    Jun 03, 2009#1

    I frequently use the Comment Add and Comment Remove for hundreds of lines at a time.

    I recently upgraded to UE 15.00.0.1033 and there seems to have been a slowdown in the Comment Remove.

    Comment Add is instantaneous as always but there is noticable scrolling when removing comments.

    Has anyone else noticed that?

    TD

    6,603548
    Grand MasterGrand Master
    6,603548

      Jun 03, 2009#2

      I use Comment Add/Remove of UltraEdit nearly daily. In all versions of UltraEdit Comment Remove is slow while Comment Add is very fast. A test with 1000 lines selected in a *.c file with UE v11.20b, UE v14.20.1.1008 and UE v15.00.0.1046 on the same computer confirmed that.

      I guess, for adding a comment UltraEdit uses internally a regular expression replace or Column - Insert Column, I don't really know. But for removing a line comment it analyzes line by line. I don't know the reason for that difference. So for removing line comments at start of hundreds of lines I use a regular expression replace in selected text, sometimes Column - Delete Column which is also fast, but requires that every line in the selection starts with a line comment. Maybe UltraEdit uses interally Column - Insert Column for adding a line comment and because removing with Column - Delete Column can't be done when 1 line in the selected block does not start with a line comment, UE analyzes line by line. Maybe I should suggest IDM to use internally always a regular expression replace for Comment Add/Remove.

      The new GUI is currently slower than the previous one. The performance loss depends on your computer and the Windows configuration. On my 8 year old Pentium 4 with 2 GHz with an extremly optimized Windows XP for maximum performance the performance loss is not really noticeable, but some users already reported noticeable delays on their computers. I'm sure the IDM developers will look into it and make performance enhancements in future versions.

      And please update to currently latest version 15.00.0.1046 of UltraEdit. There are several serious bugs fixed in currently latest version.
      Best regards from an UC/UE/UES for Windows user from Austria

      6
      NewbieNewbie
      6

        Jun 03, 2009#3

        Updated to 1046, thanks..

        In SQL files, replace ^p-- with ^p is super fast so I may script/macro that.

        6,603548
        Grand MasterGrand Master
        6,603548

          Jun 04, 2009#4

          Don't use ^p-- as search string, use UltraEdit regular expression search string %-- or Unix/Perl regular expression search string ^--. Then the macro would work also for the first and last line of a selection. Example macro for comment remove:

          IfSel
          Else
          SelectLine
          EndIf

          UltraEditReOn
          IfExtIs "sql"
          Find MatchCase RegExp SelectText "%--"
          Replace All ""
          ExitMacro
          EndIf
          IfExtIs "c"
          Find MatchCase RegExp SelectText "%//"
          Replace All ""
          ExitMacro
          EndIf
          IfExtIs "cpp"
          Find MatchCase RegExp SelectText "%//"
          Replace All ""
          ExitMacro
          EndIf
          IfExtIs "h"
          Find MatchCase RegExp SelectText "%//"
          Replace All ""
          ExitMacro
          EndIf

          IfExtIs is not case-sensitive. My example demonstrates how to use 1 macro for comment remove for several type of files. So you can remove the hotkey for command Comment Remove in the key mapping configuration dialog and assign the hotkey to the general macro for fast comment remove. The macro should be in a macro file which is specified to be automatically loaded.

          Note: The macro uses the syntax of UltraEdit v15.00 (v14.20.1.1006 and later). For previous versions the macro code is slightly different.

          Edit on 2009-06-05: Inserted red marked macro code and removed last EndIf to be able to remove the line comment at start of the current line without need to select it. Disadvantage in comparison to command Comment Remove is that the cursor position changes and the line is still selected after executing the macro when nothing is selected and therefore simply the line comment at start of the current line should be removed. A more smart approach would require to use a script instead of a macro.
          Best regards from an UC/UE/UES for Windows user from Austria