Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
![rtextBigFile](https://user-images.githubusercontent.com/17149962/201384467-a17d997f-b49f-4e1b-a124-3888af9c8687.png)
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.
![intellijBigFile](https://user-images.githubusercontent.com/17149962/201384543-a18ff64d-ff02-48a3-8e18-408acdbb6e0e.png)
The same approach used in IntelliJ: