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

fix(color): off-by-one for INDEXED_COLORS access #191

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

RoloEdits
Copy link
Contributor

@RoloEdits RoloEdits commented May 31, 2024

Current implimentation sets the value right from the color tags value, e.g <color indexed="2", which is already zero-indexed.

Ok(ref attr) if attr.key.0 == b"indexed" => {
self.indexed
.set_value_string(get_attribute_value(attr).unwrap());
}

The - 1 would then access the previous indexes color if it was <color indexed="1..", or return None if it was <color indexed="0".

The flipside to this is change is that the implimentation for set_value no longer needs to add 1. The tests for this have been modified for this change.

I added a single test with red color "RED" in A1
image

which results in an styles.xml with:

<font>
    <sz val="11.000000" />
    <color indexed="2" />
    <name val="Calibri" />
    <scheme val="minor" />
</font>

@MathNya MathNya merged commit 503024f into MathNya:master Jun 4, 2024
1 check passed
@MathNya
Copy link
Owner

MathNya commented Jun 4, 2024

@RoloEdits
Thank you very much.
We will merge three PRs.

@RoloEdits RoloEdits deleted the color-index-obo branch June 4, 2024 03:08
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.

2 participants