Open basix86 opened 2 years ago
Can you update this commit to not include all of the whitespace changes? It will make the PR easier to review and avoid unnecessary changes to git history.
Sure, I miss disable the automatic format before pushing. Do you use IntelliJ Idea? Do you have a custom code-style configuration?
REVIEW NOTE: I have implemented a new document called ReadOnlyDocument. It extends the RSyntaxDocument. I don't like the idea to extend another class but in that case, it could be the easiest solution to modify less code as possible. In the future could be an idea to create and implement RSyntaxDocumentInterface. I'm not sure if the ReadOnlyDocument name is the best name for the class. Any suggestion? LazyDocument?
Big changes are in TextEditorPane in order to manage two different document types. I have added a public method loadDocument(FileLocation, RSyntaxDocument, Charset) in order to create ed initialize the outside editor of the new document (e.g in a separate thread with a progress bar, try ReadOnlyDocumentLauncher with a file of 50MB).
Hi, @bobbylight do you have any feedback? I know that changes have some impact on the editor's architecture. With these modification, we should add support for two types of documents. Thanks
Hi @basix86 ! I'm tying to wrap up a minor release with mostly keyboard issues before going on holiday for EOY. I'll dig into this and other meatier stuff after that release.
@bobbylight have you planned the release date?
This pull request aims to add the possibility of reading a huge file (e.g. log files)
Usually when a file is opened all contents are copied into memory. This approach can be memory-consuming with very big files.
Example of warning of RText:
To solve the problem I have used a paging approach. I suppose that, in a text editor, there are many sequential reads, always in the same zone of the file. I copy in memory only a part of the file (e.g. 1 MB) and relative offset.
When we need to access another zone of the file (e.g user scrolls down in the file, we change the offset, and we reload the new part of the file).
The offset is not easier to manage. For that region, I choose to open the file in read-only mode. The same approach used in IntelliJ: