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.