Skip to content

Refactored file access to use memory mapped file#24

Merged
merces merged 1 commit into
mentebinaria:mainfrom
sergiogarciadev:reader_refactor
Jan 18, 2026
Merged

Refactored file access to use memory mapped file#24
merces merged 1 commit into
mentebinaria:mainfrom
sergiogarciadev:reader_refactor

Conversation

@sergiogarciadev
Copy link
Copy Markdown
Contributor

This is a big change, take extra care when testing.

This PR refactor file access to use Memory Mapped IO, which let us handle file access like if the entire file was on memory. Actual read from disk occurs each time we access a page for the first time, make it very easy to the programmer as it doesn't need to calculation to check if a page is cached or problems like rendering page between cache boundaries, enabling smoother transition between pages.

As cache is now handled by the OS, pages can be dynamic calculated to use all the available terminal size.

This PR should fix #4 and #5, it will also makes fixing #9 easier.

It also should fixes #10 , but I think there is room for improvement.

@merces
Copy link
Copy Markdown
Member

merces commented Jan 18, 2026

This is quite nice, @sergiogarciadev. I just tested and couldn't see any bugs related to your PR. Thanks a lot!

@merces merces merged commit b433252 into mentebinaria:main Jan 18, 2026
6 checks passed
@sergiogarciadev sergiogarciadev deleted the reader_refactor branch January 18, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text view does not show the entire file contents Cache scheme

2 participants