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

Split long long lines into slices. #712

Closed
wants to merge 1 commit into from
Closed

Split long long lines into slices. #712

wants to merge 1 commit into from

Conversation

treere
Copy link

@treere treere commented Nov 1, 2019

this should fix #636

Now lines are read using the buffer of BufRead.
I added an enum to set if the current line is an entire line or a subpart.

(If a line is longer than 1024*1024 the highlight does not work as expected)

@Enselic
Copy link
Collaborator

Enselic commented Jun 5, 2021

Labeling as needs-work since there are quite big conflicts that needs to be sorted out at the moment. I took a shot at it, but it was too tricky for a quick rebase.


use content_inspector::{self, ContentType};

use crate::errors::*;

const THEME_PREVIEW_FILE: &[u8] = include_bytes!("../assets/theme_preview.rs");
const MAXIMUM_LINE_LENGTH: usize = 1024 * 1024;

/// This function is like the read until present in the standard library
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone picks this PR up: There is no need to duplicate this function. We can use take() instead. See https://github.com/sharkdp/bat/pull/1972/files#r763022008

@Enselic
Copy link
Collaborator

Enselic commented Aug 18, 2022

I'm closing this now to keep our PR inbox clean and easy to get an overview of. I explicitly mentioned in #636 that anyone looking to fix this issue should also take a look at this PR.

@Enselic Enselic closed this Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

files of infinite length cause bat to crash
2 participants