Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file picker freezes on big binary files #847

Closed
adsick opened this issue Oct 15, 2021 · 10 comments
Closed

file picker freezes on big binary files #847

adsick opened this issue Oct 15, 2021 · 10 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug E-good-first-issue Call for participation: Issues suitable for new contributors

Comments

@adsick
Copy link

adsick commented Oct 15, 2021

so when I am in my Downloads folder and use my Up and Down arrows to navigate the menu I experience full freeze when something like Linux distribution 1.9Gb iso image is selected.

one thing it does not even need to preview these types of files, the second: preview is implemented in a wrong way so it (supposedly) tries to read the file entirely when only the first "page" is enough.

@adsick
Copy link
Author

adsick commented Oct 15, 2021

also I don't quite understand why file picker works the way it does - I would expect it to list only current working dir files, but it lists every imaginable file on my desktop.

@Omnikar
Copy link
Contributor

Omnikar commented Oct 15, 2021

also I don't quite understand why file picker works the way it does - I would expect it to list only current working dir files, but it lists every imaginable file on my desktop.

What displays when you :pwd?

@adsick
Copy link
Author

adsick commented Oct 15, 2021

ah, it displays me my home dir, but why it does so if I've opened helix with hx rust/temp/iter-test

@kirawi
Copy link
Member

kirawi commented Oct 15, 2021

This is likely related to #338

Edit: Never mind, I misread.

@kirawi kirawi added A-helix-term Area: Helix term improvements C-bug Category: This is a bug labels Oct 15, 2021
@kirawi
Copy link
Member

kirawi commented Oct 15, 2021

Hmm, are you using 0.4.1? If so, can you try to build from master to see if it works?

@Omnikar
Copy link
Contributor

Omnikar commented Oct 15, 2021

ah, it displays me my home dir, but why it does so if I've opened helix with hx rust/temp/iter-test

If you start helix with a directory as the argument, it will use that directory. Otherwise, it will use the directory your shell is currently in.

@adsick
Copy link
Author

adsick commented Oct 15, 2021

If you start helix with a directory as the argument, it will use that directory.

I don't understand, I mentioned the directory, but helix remained in the current one (home)

@Omnikar
Copy link
Contributor

Omnikar commented Oct 15, 2021

I don't understand, I mentioned the directory, but helix remained in the current one (home)

Oh, I see. I imagine it should work like that, but apparently it doesn't. I guess I can try and fix that and open a PR.

#849

@archseer
Copy link
Member

We should skip rendering both binary files and files over a certain limit (10-20MB)

@kirawi kirawi added the E-good-first-issue Call for participation: Issues suitable for new contributors label Oct 19, 2021
archseer added a commit that referenced this issue Nov 4, 2021
* Prevent preview binary or large file (#847)

* fix wrong method name

* fix add use trait

* update lock file

* rename MAX_PREVIEW_SIZE from MAX_BYTE_PREVIEW

* read small bytes to determine cotent type

* [WIP] add preview struct to represent calcurated preveiw

* Refactor content type detection

- Remove unwraps
- Reuse a single read buffer to avoid 1kb reallocations between previews

* Refactor preview rendering so we don't construct docs when not necessary

* Replace unwarap whit Preview::NotFound

* Use index access to hide unwrap

Co-authored-by: Blaž Hrastnik <[email protected]>

* fix Get and unwarp equivalent to referce of Index acess

* better preview implementation

* Rename Preview enum and vairant

Co-authored-by: Gokul Soumya <[email protected]>

* fixup! Rename Preview enum and vairant

* simplify long match

* Center text, add docs, fix formatting, refactor

Co-authored-by: Blaž Hrastnik <[email protected]>
Co-authored-by: Gokul Soumya <[email protected]>
@archseer
Copy link
Member

archseer commented Nov 4, 2021

Fixed by #939

@archseer archseer closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug E-good-first-issue Call for participation: Issues suitable for new contributors
Projects
None yet
Development

No branches or pull requests

4 participants