Notepad3: How is ASCII Art detected?

Created on 28 Feb 2020  路  8Comments  路  Source: rizonesoft/Notepad3

Hi, I have two files, both UTF-8 plaintext, but they don't have any extension (important as they're correctly detected when renamed to .txt for example. One is detected as a standard text file and the other as ASCII Art. It's not the first time I come across it, but this time it was in widely available files, and the way ASCII Art is displayed made it obvious to me something was wrong.

I tried RC1 and also building Notepad3 myself from master (which would be RC2 or past it) and the representation is the same. I'm attaching both files as well as how they're rendered so you can diagnose it better.

This would be LICENSE:

LICENSE

And this README (the incorrectly IDd one, notice the lack of ClearType or antialiasing, etc):

README

I don't think it's related to #2026 or #2029, disabling the option mentioned in #2026 didn't make a change.

I added the extension to the files to be able to upload them here since GitHub doesn't support extension-less attachments.

LICENSE.txt
README.txt

works as designed

Most helpful comment

@KaoDome : I moved the files names mentioned above from the "hard coded place", to the corresponding configurable place (in Customize Schemes...) as RegEx for their filename.
So the former behavior is preserved (e.g. load "README" as ANSI Art), but now it is configurable.

Feel free to test the RC2 prototype version "Notepad3Portable_5.20.229.2_RC2.paf.exe.7z" or higher.
See "Notepad3 BETA-channel access issue #1129" or here Notepad3Portable_5.20.229.2_RC2.paf.exe.7z.

Note: "Notepad3Portable RC2" can be used in "2 flavors" (with or without the extension ".7z").

Your comments and suggestions are welcome... 馃槂

All 8 comments

Hello @KaoDome,

beside the Custom Scheme file extension lexer configurations (if auto-select option is active),
there are a few "hard coded" assignments for file names w/o extension (case insensitive) in the source code:


    • Readme --> ANSI Art


    • Makefile, Kbuild --> Makefiles


    • Rakefile, Podfile --> Ruby


    • mozconfig --> BASH


    • Kconfig, Doxyfile --> Configuration Files

In your issue, case 1. selects the ANSI Art lexer ...

Inherited burdens from good old Notepad2 days 馃槈

@KaoDome : I moved the files names mentioned above from the "hard coded place", to the corresponding configurable place (in Customize Schemes...) as RegEx for their filename.
So the former behavior is preserved (e.g. load "README" as ANSI Art), but now it is configurable.

Feel free to test the RC2 prototype version "Notepad3Portable_5.20.229.2_RC2.paf.exe.7z" or higher.
See "Notepad3 BETA-channel access issue #1129" or here Notepad3Portable_5.20.229.2_RC2.paf.exe.7z.

Note: "Notepad3Portable RC2" can be used in "2 flavors" (with or without the extension ".7z").

Your comments and suggestions are welcome... 馃槂

I never knew about the extensionless hard-codings, interesting.

A side-effect of the movement into schemes is that a file named with one of the above names _but with an extension that maps to a different Notepad3 scheme_ now opens with the predefined scheme. For example, file "readme.txt" opens with the "ANSI Art" scheme. I would vastly prefer that it stays opening with the "Text Files" scheme.

Can I please suggest that we change this to target only extensionless files?

(Tested version: 5.20.229.2 RC2)

A side-effect of the movement into schemes is that a file named with one of the above names _but with an extension that maps to a different Notepad3 scheme_ now opens with the predefined scheme

Hello @craigo- ,
It seems that the solution is ending with a "$". 馃

2020-03-02_045116

Today, I will build a corrected version.

@hpwamr : Yes, this the half the way down 馃槈 To work as former version, we have to limit the begin too: \^Readme$ woud be fine. I am going to commit the corrected version ...

Feel free to test the RC2 prototype version "Notepad3Portable_5.20.302.1_RC2.paf.exe.7z" or higher.
See "Notepad3 BETA-channel access issue #1129" or here Notepad3Portable_5.20.302.1_RC2.paf.exe.7z.

Note: "Notepad3Portable RC2" can be used in "2 flavors" (with or without the extension ".7z").

Your comments and suggestions are welcome... 馃槂

Hello @KaoDome ,
As far as I'm concerned, I think you (requester) can close this issue...

Hello everyone and thanks for everything! I'm sorry about the delay, I was away for a couple of days.

I didn't know about the hard-coded schemes for those files either, I thought it had to do with the detection code, although in retrospect seeing that when renamed to text files didn't trigger the scheme I should have suspected something was up haha.

And thanks for integrating it in the customized styles instead, the default behavior remains unchanged and users that need it can still remove the association without needing to make a custom build ^^,

I'll be closing the issue now.

Was this page helpful?
0 / 5 - 0 ratings