Document property currentColumnNum returns different value with UE v16.00+

Document property currentColumnNum returns different value with UE v16.00+

6,686585
Grand MasterGrand Master
6,686585

    Mar 16, 2010#1

    Hello script writers!

    Prior UltraEdit v16.00 and prior UEStudio v10.00 document property UltraEdit.activeDocument.currentColumnNum contains the current column number in the active line of the active file starting the count with 0.

    But most script commands like gotoLine() or sortAsc() require value 1 for start of a line (= first column) because value 0 is interpreted as current column of the cursor in the file.

    Therefore with using the tag list view with the standard tag list file taglist.uet, double clicking on list entry Get Column Number on tag group UE/UES Script Commands inserted following into the file (| marks the cursor position):

    var | = UltraEdit.activeDocument.currentColumnNum + 1;

    Starting with UltraEdit v16.00 and UEStudio v10.00 the counting changed. The first column has now value 1 and not 0 as in previous versions of UltraEdit and UEStudio. As a result of this change all scripts using currentColumnNum written for a previous version of UltraEdit are not working correct after upgrading to UE v16.00 or UES v10.00 or any later version. The scripts must be adapted. Often just + 1 must be removed, but it depends on the script what to do.

    When a script writer has already written or wants to write a public released script using document property currentColumnNum, the script should work independent of the version of UltraEdit and therefore needs code which produces always the same result independent of the version of UltraEdit. This is possible for example with using following code:

    Code: Select all

    var nColNum = UltraEdit.activeDocument.currentColumnNum;
    if (typeof(UltraEdit.activeDocumentIdx) == "undefined") nColNum++;
    UltraEdit.activeDocumentIdx is not defined in UltraEdit prior v16.00 respectively UEStudio prior v10.00 and then the second code line increases the column number by 1 to get the same value for the column number as UE v16.00 / UES v10.00 contains in the document property and needed in most commands.

    262
    MasterMaster
    262

      Mar 16, 2010#2

      Hello Mofi.

      Thanks for the "heads up" - I wasn't aware of this until now.

      Regards Jorrasdk

        Mar 16, 2010#3

        Hello again

        The explanation of currentColumnNum in the Help file of UE 16.00 (UE 16.00.0.1032) is still Returns value of current column number. The first column is numbered as "0".. This could sure lead to some confusion.

        Mofi, I guess you are in the process of changing all your community released scripts (like FindSelectInnerOuter.js) and will send them to IDM to update the ones in the Scripts page? And could you then be bothered to report the confusing help text, please? Thanks.

        6,686585
        Grand MasterGrand Master
        6,686585

          Mar 17, 2010#4

          jorrasdk wrote:I guess you are in the process of changing all your community released scripts (like FindSelectInnerOuter.js) and will send them to IDM to update the ones in the Scripts page? And could you then be bothered to report the confusing help text, please?
          My community released scripts are updated now on IDM's server. I reported also the wrong statement in help (corrected in help of UE v16.00.0.1036) and sent IDM an updated standard taglist.uet (installed into UltraEdit program directory with v16.00.0.1036).

          Additionally I searched the forum for all topics containing script code with currentColumnNum and updated the code. I hope, I have not overseen an occurrence of currentColumnNum and have not made a mistake during editing the codes of those scripts. Furthermore I hope no author of the posted scripts which I modified to fix the compatibility problem feel that my modification of their scripts violates their copyright.