josueBarretogit / manga-tui

Terminal-based manga reader and downloader with image support
https://crates.io/crates/manga-tui
MIT License
481 stars 13 forks source link

fix: issues with windows displaying images #32

Closed Gipson62 closed 2 months ago

Gipson62 commented 2 months ago

This PR is intended to fix https://github.com/josueBarretogit/manga-tui/issues/26. I wouldn't call it a complete fix (it's still a work in progress), but at least it makes images viewable on Windows, they aren't too small. I'll still continue working on it in the future to try to get a perfect fix tho.

Gipson62 commented 2 months ago

Btw, I found winsafe if you prefer, so you don't have another crate (mine win-term) with just two functions in it. I can quickly change it if it bothers you. A friend of mine said it could lead to some security risk 😅

josueBarretogit commented 2 months ago

Hey I find it really cool that you published a crate to solve this, if it doesn't take you too much time use winsafe, also if you need to call unsafe functions just remove the #![forbid(unsafe_code)] at main also add [target.'cfg(windows)'.dependencies] so that it is only compiled for windows

Gipson62 commented 2 months ago

Done, I had to, sadly, remove the #[forbid(unsafe_code)] as winsafe didn't allow me to get the console window. Maybe it does, but as every huge documentation, it's surprisingly empty and impossible to understand...

Gipson62 commented 2 months ago

Thanks this is going in the right direction, it must be a nightmare to work with the windows apis and their massively undocumentend crates so I appreciate your willingness to help. hopefully in the future bill gates adds the getConsoleFontSize idk

Not adding this function, but making it works 🤷‍♂️ . But the issue is: instead of using actually terminals/consoles nowadays, they start an app that emulate a terminal, so the app never get access to the font size of what it's emulating (yes that's dumb asf, don't ask me why)

Gipson62 commented 2 months ago

I love open source, I had an issue with something, just went, fixed it, proposed the changes, and now it'll be fixed for everyone 🥳