topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday April 23, 2021, 4:29 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Deozaan's Simple Text Editor  (Read 621 times)

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,321
    • View Profile
    • Donate to Member
Deozaan's Simple Text Editor
« on: March 19, 2021, 03:27 AM »
I've recently started learning how to use the Godot Engine. It's a game engine, but it can be used for non-game apps as well. As a means of familiarizing myself with Godot, I have been working on some simple projects.

The first one I made is a simple text editor. I started out just following a tutorial series on YouTube and then I added a few more features until I lost interest and was ready to move on to something else.

Simple Text Editor - Hello World.pngDeozaan's Simple Text Editor

Considering it's my first complete project in Godot, I expect there are plenty of bugs. And I certainly don't expect it to compete with the likes of Notepad++, or even Microsoft Notepad, for that matter.

Jotti says it's clean.
VirusTotal says it's clean.

You can download it from my Keybase: https://keybase.pub/...an/SimpleTextEditor/

Just thought I'd share with anyone here who might be interested. :Thmbsup:

Oh, and right now I only have a Windows build available for download. But if anyone is interested in Linux or MacOS builds, let me know and I can supply those as well.

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 603
    • View Profile
    • Donate to Member
Re: Deozaan's Simple Text Editor
« Reply #1 on: March 19, 2021, 05:31 PM »
I will check out your experiment! (12mb is a bit big, first impression ^^)

Lets see if hardware accelerated text editing make my day  :D

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 603
    • View Profile
    • Donate to Member
Re: Deozaan's Simple Text Editor
« Reply #2 on: March 19, 2021, 06:26 PM »
More impressions:

I loaded a .txt file.

Screenshot - 20.03.2021 , 00_03_09.pngDeozaan's Simple Text Editor

Window Caption/Title is wrong, file has a name, trust me :)
Your counters are not working? All say 0, as you can see their is text.
Opening Microsoft Word files = Application Crash.
On some flles the vertical scroll does not work correct, When I am at EOF the line is behind your statusbar.
Program messes around with my Registry/NVidia/OpenGL settings by creating keys.
Everything is a bit too dark. Dark Menu on Dark Background... (maybe add a lightgray border to have it more seperated)
There will be a file created (prefs.dat), does not work if running inside Windows protected folders!
Save As: Does not offer any text formats (Ascii, Ansi, UniCode etc.)

Alot to do, but crazy whats possible with 3d-Engine  8)

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,321
    • View Profile
    • Donate to Member
Re: Deozaan's Simple Text Editor
« Reply #3 on: March 20, 2021, 02:35 AM »
I will check out your experiment! (12mb is a bit big, first impression ^^)

Thanks for checking it out. :D I guess the 12 MB is due to it being a complicated game engine with custom UI stuff rather than just some native OS UI and code. If I used .7z format I could get it down to about 8 MB, but I opted for .zip format for maximum compatibility.

I really wasn't intending on working on this project further, but it seems you've found a lot of bugs that need fixing!

I loaded a .txt file. Window Caption/Title is wrong, file has a name, trust me :)

Strange. I was pretty sure I had that working. But I see that it is indeed broken for me, too.

Fixed in the new release.

Your counters are not working? All say 0, as you can see their is text.

The counters work, but I forgot to have them update when loading a file. :-[ If you press any key it will immediately update the counts.

Fixed in the new release.

Opening Microsoft Word files = Application Crash.

This is designed for plaintext only. But it probably shouldn't crash when an unsupported format is loaded. Upon further investigation, it looks like I made a mistake in attempting to gracefully handle errors when loading files. It was confusing because printing the error (which is an integer) to the debug log will automatically convert it to a string. But I attempted to add a more helpful message to the log and concatenate the error to the message, not realizing that string concatenation doesn't automatically cast the integers to strings.

In other words, I think the crash was caused by an error in the code meant to display useful information about an error that had been handled gracefully. ;D

I believe I've got this fixed for the new release.

There will be a file created (prefs.dat), does not work if running inside Windows protected folders!

Good point. I was attempting to make it run "portably" and just write everything in the same directory as the executable. I didn't think about people putting it inside protected folders.

It will write to the user directory (AppData/Roaming/Deozaan/SimpleTextEditor) in the new release.

On some files the vertical scroll does not work correct, When I am at EOF the line is behind your statusbar.

Ah yes, that's interesting. It seems it doesn't always automatically scroll down to keep the caret visible. The scroll bar functionality is all built-in stuff that Godot provides. I don't know how to change it. But what I've noticed is that it has something to do with the height of the TextEdit UI control. So, for the new release I've changed the default window size which should make it automatically scroll to keep the caret visible at all times. Unless you resize the window, of course.

But since the window size is saved/loaded to prefs.dat, you may need to use the View -> Reset Window Size/Position menu item to get it to the default size again.

Program messes around with my Registry/NVidia/OpenGL settings by creating keys.

It does? So much for running it portably... I'm not sure I have any control over that. It may be something Godot does on its own. But if you can tell me what changes it makes I can look into whether or not I can prevent that from happening.

Everything is a bit too dark. Dark Menu on Dark Background... (maybe add a lightgray border to have it more seperated)

Can you be more specific about this? Yes, the backgrounds are dark, but the foreground text is light, which should result in decent contrast and easy readability.

Save As: Does not offer any text formats (Ascii, Ansi, UniCode etc.)

I think I'm going to file this one as "working as intended" since I have no plans to support anything except UTF-8 format.



I've uploaded v1.210320.0 with the aforementioned fixes to my KeyBase: https://keybase.pub/...an/SimpleTextEditor/

Jotti says it's clean.
VirusTotal says it's clean.
« Last Edit: March 20, 2021, 02:46 AM by Deozaan »

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 603
    • View Profile
    • Donate to Member
Re: Deozaan's Simple Text Editor
« Reply #4 on: March 20, 2021, 06:53 AM »
Opening Microsoft Word files = Application Crash.
But it probably shouldn't crash when an unsupported format is loaded.
I believe I've got this fixed for the new release.
Bad news.
On more testing, more things happen.
Errorhandling should be improved.
I did try open files that are not supposed to be opened by your program.
Program will freeze and can not be restarted after I terminate process.
I needed to go into my /user/.... folder and delete prefs.dat and logs folder, otherwise program is not able to run anymore. It simply does nothing.
My suggestion: limit file dialog filter to *.txt and not *.*.
-KodeZwerg
//edit
Another suggestion: When opening Editor and try load a file, filedialog starts in my \user\... folder where the prefs.dat file is.
Let is open from \Documents\ or folder where the .exe is.
//end edit

Program messes around with my Registry/NVidia/OpenGL settings by creating keys.
But if you can tell me what changes it makes I can look into whether or not I can prevent that from happening.
No adjustment needed, I will apply image to that subject.
Screenshot - 20_03.pngDeozaan's Simple Text Editor
That is okay. You do not have possibilites to avoid such, that is the used 3d-Engine.
-KodeZwerg

Everything is a bit too dark. Dark Menu on Dark Background... (maybe add a lightgray border to have it more seperated)
Can you be more specific about this? Yes, the backgrounds are dark, but the foreground text is light, which should result in decent contrast and easy readability.
I will add Image to that subject.
Screenshot - 20_03_2021 , 12_22_38.pngDeozaan's Simple Text Editor
If Border would be lightgray from menu, the visual content would not look "melted" (?)
-KodeZwerg

All other mentioned things are fixed as far as i did test!!!

I hope this helps, no criticism at all, as said, crazy what you can do with a framework that is not designed to do such!!! Got my respect for that +1
« Last Edit: March 20, 2021, 07:21 AM by KodeZwerg »

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10,876
    • View Profile
    • Donate to Member
Re: Deozaan's Simple Text Editor
« Reply #5 on: March 20, 2021, 09:05 AM »
This is designed for plaintext only. But it probably shouldn't crash when an unsupported format is loaded. Upon further investigation, it looks like I made a mistake in attempting to gracefully handle errors when loading files. It was confusing because printing the error (which is an integer) to the debug log will automatically convert it to a string. But I attempted to add a more helpful message to the log and concatenate the error to the message, not realizing that string concatenation doesn't automatically cast the integers to strings.


Can you limit the extensions to *.txt only? That's a clear sign that it's a text editor for the purposes of this small test, since you didn't really intend it for anything.

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,321
    • View Profile
    • Donate to Member
Re: Deozaan's Simple Text Editor
« Reply #6 on: March 20, 2021, 06:34 PM »
This is designed for plaintext only. But it probably shouldn't crash when an unsupported format is loaded. Upon further investigation, it looks like I made a mistake in attempting to gracefully handle errors when loading files. It was confusing because printing the error (which is an integer) to the debug log will automatically convert it to a string. But I attempted to add a more helpful message to the log and concatenate the error to the message, not realizing that string concatenation doesn't automatically cast the integers to strings.


Can you limit the extensions to *.txt only? That's a clear sign that it's a text editor for the purposes of this small test, since you didn't really intend it for anything.

I can do that. I just chose not to because not all plaintext files end in .txt extension, such as .ini, .log, .json, etc. This is especially true on different platforms such as Linux, which often has plaintext files with no extension at all. That said, this thread has convinced me to reconsider, and I will set it to filter *.txt by default. The problem is that it will still allow you to select *.* from the dropdown, so if you do that and try to load an incompatible file type, it could potentially still crash/lock the program.

Simple Text Editor - Filter Dropdown.pngDeozaan's Simple Text Editor

Opening Microsoft Word files = Application Crash.
But it probably shouldn't crash when an unsupported format is loaded.
I believe I've got this fixed for the new release.

Bad news.
On more testing, more things happen.
Errorhandling should be improved.
I did try open files that are not supposed to be opened by your program.
Program will freeze and can not be restarted after I terminate process.
I needed to go into my /user/.... folder and delete prefs.dat and logs folder, otherwise program is not able to run anymore. It simply does nothing.
My suggestion: limit file dialog filter to *.txt and not *.*.

I've just experimented with a bunch of different file types and filesizes. I've made some improvements that should allow it to fail faster. But in the process I've discovered that it can still take a very long time to parse a large text file. That is, I've successfully (failed) loading an invalid 385 MB zip file almost instantly. But attempting to load a valid 128 MB text file locks up the application while it attempts to parse the string data and display it. Presumably if you wait around long enough it will recover and eventually display it. After a few tests trying to open incompatible filetypes of various filesizes, the final one which was only about 11.5 MB and had me waiting about 50 minutes before it recovered (this was before I fixed things to fail faster), I decided I didn't have the patience to see how long it would take to open the 128 MB text file.

I think my changes to fail faster will also fix the program being unable to run again if the process is terminated, since it now reads the bytes from the file system very quickly and closes the file before attempting to parse the bytes into a readable/displayable string.

And finally, I've added a dialog which warns you when you're about to open a large file and makes sure you really want to do it. I have arbitrarily decided to warn only for files larger than 8 MB. Though that may still be too large. The smallest large text file I could find was ~37.5 MB and it locked up the program for longer than I ever bothered waiting before terminating the process. Hopefully 8 MB isn't too bad.

Simple Text Editor - Large File Warning.pngDeozaan's Simple Text Editor

Program messes around with my Registry/NVidia/OpenGL settings by creating keys.
But if you can tell me what changes it makes I can look into whether or not I can prevent that from happening.
That is okay. You do not have possibilites to avoid such, that is the used 3d-Engine.

This looks to me like it is your GPU reading/writing stuff, because Godot requests access to have the GPU render things.


Everything is a bit too dark. Dark Menu on Dark Background... (maybe add a lightgray border to have it more seperated)
Can you be more specific about this? Yes, the backgrounds are dark, but the foreground text is light, which should result in decent contrast and easy readability.
If Border would be lightgray from menu, the visual content would not look "melted" (?)

I still don't see the problem here. When you click a menu, you expect the options to show up below it. They do. Each option is clearly visible and blocks out the content behind it. Unless I'm missing a vital problem that you're trying to communicate to me, I think I'm going to chalk this one up to personal preference and say I don't intend to fix it, since it would require delving into customizing the theme.

FYI I didn't choose the color scheme. I pretty much just used the default colors for Godot's UI controls.

Godot Window.pngDeozaan's Simple Text Editor

You can find v1.210320.1 on my KeyBase: https://keybase.pub/...an/SimpleTextEditor/

Jotti report.
VirusTotal report.
« Last Edit: March 20, 2021, 06:39 PM by Deozaan, Reason: fixed quotes »