EmEditor v22.1.0 released (including technical review)!

Today, we are releasing EmEditor v22.1.0.

A major feature of EmEditor Professional v22.1 is support for modern JavaScript (also called ECMAScript) using the V8 JavaScript engine. This feature was requested by many customers (including 1). Previous versions of EmEditor used JScript, which was implemented based on the Active Scripting technology for Internet Explorer. While this had the advantage of supporting many other Active Scripting languages such as VBScript, PerlScript, PHPScript, Python, and RubyScript, it lacked support for the latest versions of JavaScript. EmEditor Professional v22.1 now supports modern JavaScript while still supporting old JScript and other Active Scripting languages.

By default, your JavaScript macros will still run using the old JScript engine. To use the V8 engine for your JavaScript macro, you can add the following line at the top of your macro:

#language="v8"

If you want to use V8 for all your JavaScript macros by default, you can select Customize on the Macros menu, and set the Use V8 as JavaScript engine option in the Options page. If you need to run a macro in JScript while selecting V8 as default, you can add the following line at the top of your JScript macro:

#language="JScript"

For more information, please see “FAQ: How do I use the V8 engine?”.

Support for modern JavaScript made it possible to use many third-party libraries. For instance, the Luxon library allows you to deal with dates and times easily like this:

#language="v8"
#include "luxon.min.js"
alert( luxon.DateTime.now().setZone('America/New_York').minus({weeks:1}).endOf('day').toISO() );

With the Currency.js library, you can do arithmetics with currencies without worrying about common floating point errors. For example,

#language="v8"
#include "currency.min.js"
var d = currency( 0 );
for( i = 0; i != 10000; ++i ) { 
    d = d.add( 0.01 );   // 10000 times $0.01
}
alert( "$" + d );  // result is $100.00 as expected. It might not be an expected result if currency.js is not used.

Currently, EmEditor macros don’t support JavaScript modules, thus you can’t use Node.js or the import keyword to import libraries. To use third-party libraries, you will have to download a library (usually with the .min.js extension), and include it using #include. For more information about using third-party libraries, please see “FAQ: How do you import libraries to a macro?”.

If you decide to run your existing macros as V8, please make sure all keywords are case-sensitively written. If your macro included:

redraw = false

You will need to rewrite it as:

Redraw = false

V8 doesn’t support the ActiveXObject object to create an object, which was supported by JScript. However, for commonly used methods, you can use newly added methods of the Shell object included in EmEditor macros instead. For instance, if your macro included:

fso = new ActiveXObject( "Scripting.FileSystemObject" );
if( fso.FileExists( filename ) ) {
    fso.DeleteFile( filename );
}

you will need to rewrite it as:

if( shell.FileExists( filename ) ) {
    shell.DeleteFile( filename );
}

Macros always run asynchronously on V8, and could become slower than JScript in some cases. Currently, the Use V8 as JavaScript engine option is turned off by default. This is due to some incompatibility issues with old JScript macros. Nevertheless, supporting modern JavaScript is inevitable, and V8 might become the default in future versions.

The support of V8 JavaScript engine was made possible by using the Microsoft Edge WebView2 control. The WebView2 control is included in recent versions of Windows 10/11. If V8 macros do not run on your computer, update your OS to the latest version of Windows 10/11, install the latest version of Microsoft Edge, or download and install the WebView2 runtime (Evergreen Bootstrapper or Standalone Installer).

The WebPreview plug-in also supports the WebView2 control to display HTML files using the Microsoft Edge browser. Unlike macros, this option is turned on by default, and you can select the browser engine in the WebPreview plug-in Properties.

EmEditor Professional v22.1 includes several new commands. One of them is called Sort/Remove Duplicate Split Strings in Selection. Suppose you have a list of words:

orange, banana, apple, banana, pineapple, apple

You can select these words and select the Sort/Remove Duplicate Split Strings in Selection command on the Sort menu. This will bring up the Sort Selection dialog box, where you can set the Remove duplicate split strings option, and choose Sort A to Z. The result will become:

apple, banana, orange, pineapple

In many cases, this command automatically detects the separator, in this case, “, ” (a comma and a space).

Another new command was introduced to deal with CSV columns. With the Sort Columns command, you can sort CSV columns at a specified line, usually the first line or heading. Previously, you could sort lines (rows) only. You can optionally remove duplicate columns (at a specified line) or remove columns with an empty cell (at a specified line).

The last new command, the Manage Columns command supersedes the previous Move/Copy Columns command. When you select the Manage Columns command on the right-click menu on the Column Header for CSV, the Manage Columns dialog box appears with a list of column headings. You can select one or more columns from the list, then drag and drop to move or rearrange the selected columns. You can also right-click on the list and select Copy and Paste to duplicate selected columns. Moreover, you can click the Delete button to delete the selected columns or click the Sort button to sort all the columns.

You can record operations using these new commands to macros. The Sort/Remove Duplicate Split Strings in Selection command will be recorded as the Sort method of the Selection object. For instance, if a selection contains words separated by a comma, the following code will sort the selection from A to Z.

document.selection.Sort( ",", "A+" );

The Manage Columns command will be recorded as the RearrangeColumns method of the Document object. For instance, the current CSV document contains 3 columns, the following code will move the first column to the right end of the document.

document.RearrangeColumns("2,3,1");

Finally for EmEditor Professional, the CommitList (Git) plug-in, developed by Makoto Emura, was updated by adding the ability to create commits, change branches, stage changes, and undo changes.

EmEditor Professional and Free v22.1 includes many new features from customers’ feedback. For instance, the new version supports a date format without separators (for instance, “yyyyMMdd”) in a number range. For instance, you can use a number range expression:

File[20221205 , 20221207 "yyyyMMdd" ].txt

to find, filter, or extract the following lines:

File20221205.txt
File20221206.txt
File20221207.txt

Makoto redesigned the Crash Report dialog box and added the ability to submit a crash report within from EmEditor Professional/Free. This reduces your burden to locate a crash report file and send it via email. We already feel positive about the new ability since we are already receiving many reports while developing beta versions, which allowed us to fix bugs before releasing this official version. We thank those who already sent us crash reports.

When we designed the Crash Report submission feature, we made sure that no personal information would be sent to us. In addition, you can decide whether to submit a crash report. If you don’t click or select the Submit button in the Crash Report dialog box, none of your data are submitted.

Finally, EmEditor Professional and Free v22.1 greatly improved the speed of counting the number of characters in a selection using multi-threaded code which is written by a SIMD instruction set. The number of characters in a selection is displayed in the status bar, and a Unicode surrogate pair is counted as one character.

Makoto came up with another idea which is to move our desktop installers and portable files from emeditor.com to emeditor.info. The new domain (emeditor.info) utilizes a content delivery network (CDN), which allows us to host and deliver files fast. This domain change might trigger an alert by some security software, but you can safely ignore and disable the alert due to the domain change.

I hope you like EmEditor, whether you use the Professional or Free version. Please contact us or write in forums if you have any questions, feature requests, or any ideas in the future.

Thank you for using EmEditor!
Yutaka Emura

Please see EmEditor v22.1 New Features for details and screenshots.

This release also includes all bug fixes while developing v22.0.

If you use the Desktop Installer version, you can select Check for Updates on the Help to download the newest version. If this method fails, please download the newest version, and run the downloaded installer. If you use the Desktop portable version, you can go to the Download page to download the newest version. The Store App versions can be updated through Microsoft Store (64-bit or 32-bit) after a few days. If you use winget, you can type “winget install emeditor” to install the latest version of EmEditor (64-bit or 32-bit detected automatically).