Skip to content

fix: Fixed "BiB" bug and improved binary prefixes #2492

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

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

Andrew15-5
Copy link
Contributor

@Andrew15-5 Andrew15-5 commented Oct 22, 2023

This is a new patch after #2483.

What's new:

I've also added comments to clarify some things. The round() function is local, but the plugin works correctly (I thought it wouldn't). I don't know how exactly M from utils.lua is used, so I didn't do M.round().

- Now there is a whitespace between value and unit.
- Now values >= 1024 YiB are shown in YiB instead of B.
- To reuse same code a new local function was added: round().
@Andrew15-5 Andrew15-5 changed the title Fixed "BiB" bug and improved binary prefixes feat: Fixed "BiB" bug and improved binary prefixes Oct 22, 2023
@Andrew15-5 Andrew15-5 changed the title feat: Fixed "BiB" bug and improved binary prefixes fix: Fixed "BiB" bug and improved binary prefixes Oct 22, 2023
@Andrew15-5
Copy link
Contributor Author

I also created a separate i variable that holds the "i" string. I just wanted the function to be as useful as possible. The way it is written right now, you can, for example, change language very easely, if someone wants to. And since units[1] is used instead of B, I figured why not use another variable for (repetitive) "i" as well.

@alex-courtis
Copy link
Member

I've also added comments to clarify some things. The round() function is local, but the plugin works correctly (I thought it wouldn't). I don't know how exactly M from utils.lua is used, so I didn't do M.round().

That's fine, round should be private i.e. not a member of utils

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

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

Many thanks for your contribution.

Works as intended, space is more readable.

@alex-courtis alex-courtis merged commit a31dfad into nvim-tree:master Oct 22, 2023
@Andrew15-5
Copy link
Contributor Author

Andrew15-5 commented Oct 22, 2023

Oh, right, I forgot to mention this (now fixed):

  • I also increased number of digits to round to from 1 to 2 (same as in git, crates.io).

@alex-courtis
Copy link
Member

Oh, right, I forgot to mention this (now fixed):

  • I also increased number of digits to round to from 1 to 2 (same as in git, crates.io).

Many thanks. I'm quite happy with the results.

alex-courtis added a commit that referenced this pull request Oct 30, 2023
)

* fix(#2467): remove newline in git paths

* fix: info size suffix and formatting (#2492)

- Now there is a whitespace between value and unit.
- Now values >= 1024 YiB are shown in YiB instead of B.
- To reuse same code a new local function was added: round().

* feat(#2312): fire `TextYankPost` event on path copy (#2489)

* feat(#2312): fire `TextYankPost` event on path copy

* stylua

* Bug fix

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>

* feat: mapping and options to sort entries in help window (#2482)

* feat: add option to sort entries in help window

* stylua

* Add keymap to toggle sorting methods

* Bug fix

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>

* fix(#2467): remove newline in git paths

* fix(#2467): change cygpath calls to array format
To avoid shell compatibility issues in msys2 environment on Windows

* stylua nit

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
Co-authored-by: Andrew Voynov <37143421+Andrew15-5@users.noreply.github.com>
Co-authored-by: Azad <49314270+Akmadan23@users.noreply.github.com>
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