Forum Replies Created
- AuthorPosts
- June 14, 2025 at 10:09 am in reply to: EmEditor syntax highlighter matching priority / precedence: Flawed? #30291
Patrick C
ParticipantHello Yutaka,
Thank you for your feedback so far!
This is currently by design, as ” and // are given higher priority than other general highlights.
Perhaps you missed my last example, where
"
and//
are disabled and only regex highlighting is used (guess I posted too many examples).Motivated by your response, I’ve now looked into this a bit deeper and narrowed down the cause.
The problem arises when a regex matches multiple characters, i.e. when using*
or+
or{3,}
etc.The following is an updated example, putting aside
"
and//
:
Two regex matches are active, all string and comment matches are disabled.″.*?″
regex match 1/2
%%.*$
regex match 2/2Same problem:
EmEditor stops matching″.*?″
as soon as it encounters%%.*$
, even though the regex match for″.*?″
has not yet been completed.Would this be difficult to fix?
Because it is a serious limitation. One could write much more accurate highlighters than what is currently possible.Your help is greatly appreciated.
Many thanks!
PatrickJune 7, 2025 at 8:28 am in reply to: I wish we can have better theming support and more themes to choose #30273Patrick C
ParticipantWouldn’t the onus to support EmEditor be on Dracula Pro rather than the other way around?
Patrick C
ParticipantGlad I could help.
Thanks for your feedback!Patrick C
ParticipantMay 26, 2025 at 4:24 am in reply to: EmEditor version 25.1.1 does not remember window size and position #30248Patrick C
ParticipantSame here.
It appears that EmEditor completely ignores the
Restore window position and Restore window size
settings in
Tools → Customize → WindowMay 6, 2025 at 1:46 am in reply to: Snippet keyboard shortcuts ignored when the cursor is past the end of the line #30223Patrick C
ParticipantSuper cool 😃
Thank you Yutaka! 🙏 ✨May 1, 2025 at 8:11 am in reply to: How to show status / progress updates when “Redraw = false;” ? #30220Patrick C
ParticipantThanks!
In hindsight this question of mine wasn’t properly thought through.
Normally I would have used the output bar (OutputBar) for status updates, but my code already used it for messages other than status updates.
What I’m now doing is store the text for the output bar in a variable, which allows me to show status updates in the output bar.
Once done the OutputBar is cleared and the output text written to the output bar.Patrick C
ParticipantPerhaps the following approach is easier for you:
Find:^(\d:\d\d)\n
selects x:xx located at the beginning of the line (^)
Replace:\1\t\t
Re-pastes xx:xx (\1) and adds two tabs (\t)
OR:0\1\t
Pastes 0 followed by xx:xx (\1) and adds one tab (\t).Find:
^(\d\d:\d\d)\n
selects xx:xx located at the beginning of the line (^)
Replace:\1\t
Re-pastes xx:xx (\1) and adds one tab (\t)Find:
^(\d:\d\d:\d\d)\n
selects x:xx:xx located at the beginning of the line (^)
Replace:\1\t
Re-pastes x:xx:xx (\1) and adds one tab (\t)Adapt according to your needs.
To replace all expressions in one single go:
Use EmEditor’s batch replace feature (Find / Replace dialogue box → Batch >>).
Batch replace also allows saving and loading your find/replace definitions (import / export).Patrick C
ParticipantEeek noticed a mistake.
The following is wrong.
Find ^0:
Replace 00:Instead:
Find^(?=\d:)
Replace0
Sorry.
Patrick C
ParticipantFirst a suggestion:
Consider replacing the timestamps below 10 minutes:
0:xx
with
00:xx
This will make the number of tabs consistent across all times below 100 minutes.The regex for that is:
Find^0:
Replace00:
Then replace the newlines after the timestamps with a tab.
Find(?<=^\d\d:\d\d)\n
Replace\t
Should you need assistance on what the regex above does:
https://regex101.com => paste the regex and a transcript.Hope this helps.
Patrick—
Remarks:
1) I’m assuming that you have no leading or trailing whitespace.
2) Find/Replace Options → Advanced button: Boost engine with all options unchecked, additional lines is set to 0.December 18, 2024 at 10:14 am in reply to: Macros dont work after Windows 11 Update to version 24H2 #30137Patrick C
ParticipantSemi-Educated guess:
Could be due to the legacy JScript and VB Script libraries. Windows 11 has been messing around with them for a while now and they are marked for removal.
Compare:
https://techcommunity.microsoft.com/blog/windows-itpro-blog/vbscript-deprecation-timelines-and-next-steps/4148301
https://learn.microsoft.com/en-us/answers/questions/2130135/jscript-runtime-error-in-windows-11-24h2Potential workaround hack:
If you don’t mind experimenting at your own risk, you could try copying Jscript.dll and vbscript.dll to the same folder as EmEditor.exe (note the 32bit vs 64bit versions).
https://www.dll-files.com/jscript.dll.html
https://www.dll-files.com/vbscript.dll.htmlMight help, might not or not quite enough …
… → note that further dlls could be required.Patrick C
ParticipantI think I found the root cause:
With
Treat CR and LF Separately disabled
and radio button Regular Expressions enabled.EmEditor’s Find in Files will interpret \n as LF as soon as the search term contains a regular expression token or actual regular expression.
Without a regular expression token, EmEditor behaves as if performing a Escape Sequence type search, presumably because this will speed up Find in File’s performance.{ and } are regular expression tokens, but most engines will treat it as a regular character until written as a complete regular expression, e.g a{3} for aaa.
Most of this is in line with EmEditor’s Help, which states:
● Find dialog box → Regex on → \n or \r\n (same meaning)
I.e. \n will match both CR+LF and LF.
● Find in Files dialog box → Regex on → \r\n, \r, or \n (depends on actual newline character)
Elaborated further in EmEditor Help → Tips
which explains that \r strictly matches CR and \n strictly matches LF, …… what is not explained in help is that
1) the Find in Files regex search will fall back to an escape sequence search when the search term does not contain at least one regular expression token
2) escaped regular expression tokens as in\{
, are no longer identified as regular expression tokens, with Find in Files then performing an escape sequence type search.Patrick C
ParticipantHello David
Sorry, I should have read your initial question more carefully, as you did explain that To be strange , img \{\n works.
I just tested this with EmEditor Version 24.4.0.
When selecting Escape Sequence instead of Regular Expressions, both Find and Find in Files work with
img {\n
.When selecting Regular Expressions (with the Boost.Regex engine) …
… and with Treat CR and LF Separately deactivated …
… and searching forimg {\n
:
● The regular find (not in files) works, regardless of CR+LF or LF line endings.
● Find in files will not find CR+LF, but it will find LF line endings.After experimenting a bit …
When using Find in Files with Treat CR and LF Separately deactivated:
As soon as the Find term contains a { or a }, \n seems to exclusively find LF but not CR+LF. This even when { is followed by text before the \n.Example:
Line 1 { abcd Line 2 def { abc Line 3
● Find in Files searching for abc\n works with both LF and CR+LF line endings.
● Find in Files searching for def { abc\n works only with LF line endings.
Adding a closing bracket as inLine 1 { abcd Line 2 def {a} abc Line 3
won’t help either, i.e.
● Find in Files searching for def {a} abc\n works only with LF line endings.What also won’t help is a complete regex, e.g. find
ab{1}c\n
.
……
Its as if { or } behave as a token to let \n match LF but no longer match CR+LF, even when Treat CR and LF Separately is disabled.As to why this is: Good question.
I guess that this is for Yutaka to answer.Cheers,
PatrickPatrick C
ParticipantWith
\r = carriage return = CR
\n = line feed = LFNew line characters across different operating systems:
All Linux / Unix: Newline = line feed = LF = \n
Old Mac OS: Newline = carriage return = CR = \r
Modern Mac OS: Newline = line feed = LF = \n
Windows & MS-DOS: Newline = carriage return followed by line feed = CR+LF = \r\n
Modern Windows: Newline = carriage return followed by line feed = CR+LF= \r\n
↳ However, as of 2024 Windows applications are increasingly capable of dealing with LF only line terminators (even Notepad).Many tools, EmEditor included, can be configured to let \n detect all newline characters, regardless of type LF, CR+LF or CR.
I.e. you can stick to \n without having to bother about what the current file’s line terminator is.Should you want to use \r\n:
In the find dialogue: ClickAdvanced...
→Treat CR and LF separately
Advanced dialog box → Treat CR and LF Separately check boxPatrick C
ParticipantThe VBScript Command is
editor.ExecuteCommandByID 3916
EmEditor Help: Negative (Filter Toolbar) command——————————————————————-
The JavaScript above expressed as VBScript is#title = "Set the negative filter flag to inactive" #language = "VBScript" #async = "off" ' get the filter toolbar’s negative status (id 3916) Dim negFilterStatus negFilterStatus = editor.QueryStatusByID(3916) ' if negative is enabled -> disable by toggling If ((negFilterStatus And eeStatusLatched) = eeStatusLatched) Then ' case negative is enabled → run the toggle command editor.ExecuteCommandByID 3916 End If
——————————————————————-
VBScript code to set all filters to 0 is (its ugly, couldn`t think of something better):#title = "Set the negative filter flag to inactive" #language = "VBScript" #async = "off" ' reset the filters list Dim filtersList Set filtersList = document.filters filtersList.Clear filtersList.Add "dummy", False, 0, 0 ' add a single item with all flags set to 0 (off) document.filters = filtersList ' apply the filter → flags are now 0 filtersList.Clear ' remove the filter again (removes ‘dummy’) document.filters = filtersList ' empty filter + the flags stay as they are
——————————————————————-
Note that VBScript is deprecated.Patrick C
ParticipantCorrection: One must test for eeStatusLatched.
#title = "Set the negative filter flag to inactive" #language = "V8" #async = "off" // get the filter toolbar’s negative status (id 3916) let negFilterStatus = editor.QueryStatusByID(3916); // if negative is enabled → disable by toggling if ((negFilterStatus & eeStatusLatched) === eeStatusLatched ) { // case negative is enabled → run the toggle command editor.ExecuteCommandByID(3916); }
EmEditor Help: Negative (Filter Toolbar) command
EmEditor Help: QueryStatusByID MethodRegarding
(negFilterStatus & eeStatusLatched) === eeStatusLatched
EmEditor uses bitwise flags for statuses. The & is a bitwise and.Patrick C
Participant#title = "Set the negative filter flag to inactive" #language = "V8" #async = "off" // get the filter toolbar’s negative status (id 3916) let negFilterStatus = editor.QueryStatusByID(3916); // if negative is enabled → disable by toggling if ((negFilterStatus & eeStatusEnabled) === eeStatusEnabled) { // case negative is enabled → run the toggle command editor.ExecuteCommandByID(3916); }
EmEditor Help: Negative (Filter Toolbar) command
EmEditor Help: QueryStatusByID MethodRegarding
(negFilterStatus & eeStatusEnabled) === eeStatusEnabled
:
EmEditor uses bitwise flags for statuses. The&
is a bitwise and.Patrick C
ParticipantAutosave:
Save the document automatically at specified time intervals.
EmEditor Help: AutosaveBackup:
When saving existing files, save the original files into the folder specified in the Backup Folder text box.
EmEditor Help: Backup
→ Basically saves a backup copy of the old version on each save. To be truly useful the Rename if the Same File Name Exists check box should also be activated.Patrick C
ParticipantIs there a way to run a macro from a custom menu?
Are you referring to a custom menu bar entry (Tools → Customise Menus)?If yes: In my case this works. I can, for example, add
“M&y Custom Date” to the Insert menu and associate it with “My Macros → MyCustomDateMacro.jsee”Inserting MyDate then is possible via
Alt+I YPatrick C
ParticipantI just realised that this also allows querying the Num, Caps and Scroll lock states 🙂🙃😃
let iScrollState = 0; iScrollState = shell.GetKeyState(0x91); if(iScrollState === 1) { alert("Scroll Lock is enabled"); } else if(iScrollState === 0 ) { alert("Scroll Lock is disabled"); } else if(iScrollState === -127) { alert("Scroll Lock is enabled and its key is down, i.e. pressed"); } else if(iScrollState === -128) { alert("Scroll Lock is disabled and its key is down, i.e. pressed"); } else { alert("Unexpected Scroll Lock state:" + iScrollState); }
🙏 🙇
Patrick C
ParticipantI once had a similar problem and resorted to PowerShell:
Get-Content .\my_UTF8_file.txt | Set-Content -Encoding utf32 my_UTF32_file.txt
or
Get-Content .\my_UTF16_file.txt | Set-Content -Encoding utf32 my_UTF32_file.txt
Kudos to https://superuser.com/questions/1163753/converting-text-file-to-utf-8-on-windows-command-prompt
+ reference https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-content?view=powershell-7.4#-encodingPatrick C
ParticipantExample code (formatted version):
#title = "URL open or select" #icon = "C:\\Windows\\System32\\shell32.dll",135 #tooltip = "URL open or select" #language = "V8" #async = "off" // Self test: https://www.emeditor.com/ // Issue with control + single click: https://www.emeditor.com/forums/topic/control-click-triggers-double-click/ // PC, Version 1.0 "use strict"; bCtrlDown = shell.GetKeyState( 0x11 ) < 0; if( bCtrlDown ) { // OutputBar.writeln( '"'.concat(document.selection.Text, '"') ); shell.Run( "c:\\Program Files\\Vivaldi\\Application\\vivaldi.exe", 1, false, '"'.concat(document.selection.Text, '"') ); document.selection.Collapse(); }
Patrick C
ParticipantIn case someone runs into an error when installing EmEditor`s local help emed_help_en_24.2.0.msi (https://www.emeditor.com/download-help/):
I did first uninstall the old help. Nonetheless the error remained.
Solution:
Remove all remaining files in
c:\ProgramData\Emurasoft\EmEditor\Help\Patrick C
ParticipantOh thank you Yutaka 😃, I`m super grateful for this and for EmEditor as a whole – best text editor ever 😃 🙏 🙇
Patrick C
ParticipantThanks!
My only use would be the Active String ctrl modifier, just in case that’s easier.
But anyway, adding the modifiers just a suggestion, if you can add it: Great. If not: I’ll be fine and appreciate all the other features that are added instead. - AuthorPosts