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

delimited hex and binary integer augend do not work #84

Closed
alex-tdrn opened this issue Nov 29, 2023 · 2 comments · Fixed by #85
Closed

delimited hex and binary integer augend do not work #84

alex-tdrn opened this issue Nov 29, 2023 · 2 comments · Fixed by #85
Labels
bug Something isn't working

Comments

@alex-tdrn
Copy link

Hello, first of all thank you for this amazing plugin.

I've ran into an issue when trying to define number dial augends for hex and binary numbers with delimiters. When trying to increment or even decrement hex numbers, 2 leading zeroes are added every time. When trying to increment a binary number, I get an error message.
Dials with radix = 10 work perfectly.
Here is a screencap:
augen_hex_binary_with_delimiter

I've reduced the config to the following lines. I am using ' as a separator here, for c++, but the same issues happen when using '_' for rust.

local augend = require("dial.augend")
require("dial.config").augends:register_group({
    default = {
        augend.integer.new({
            radix = 16,
            prefix = "0x",
            case = "lower",
            delimiter = "'",
            delimiter_digits = 2,
        }),
        augend.integer.new({
            radix = 2,
            prefix = "0b",
            delimiter = "'",
            delimiter_digits = 4,
        }),
    },
})

Here is the error message I received:

E5108: Error executing lua: .../AppData/Local/nvim-data/lazy/dial.nvim/lua/dial/map.lua:49: function dial#operator#increment_normal, line 1: Vim(lua):E5108: Error executing lua ...cal/nvim-data/lazy/dial.nvim/lua/dial/augend/integer.lua:184: attempt to perform arithmetic on local 'd' (a nil value)
stack traceback:
	...cal/nvim-data/lazy/dial.nvim/lua/dial/augend/integer.lua:184: in function 'to_string'
	...cal/nvim-data/lazy/dial.nvim/lua/dial/augend/integer.lua:303: in function 'add'
	...pData/Local/nvim-data/lazy/dial.nvim/lua/dial/handle.lua:208: in function 'operate'
	...Data/Local/nvim-data/lazy/dial.nvim/lua/dial/command.lua:120: in function 'operator_normal'
	[string ":lua"]:1: in main chunk
	[C]: in function 'normal'
	.../AppData/Local/nvim-data/lazy/dial.nvim/lua/dial/map.lua:49: in function 'manipulate'
	C:/Users/alex-/AppData/Local/nvim/lua/plugins/dial.lua:7: in function <C:/Users/alex-/AppData/Local/nvim/lua/plugins/dial.lua:6>
stack traceback:
	[C]: in function 'normal'
	.../AppData/Local/nvim-data/lazy/dial.nvim/lua/dial/map.lua:49: in function 'manipulate'
	C:/Users/alex-/AppData/Local/nvim/lua/plugins/dial.lua:7: in function <C:/Users/alex-/AppData/Local/nvim/lua/plugins/dial.lua:6>

@alex-tdrn alex-tdrn changed the title hex and binary integer augen with delimiter does not work delimited hex and binary integer augend do not work Nov 29, 2023
@monaqa monaqa added the bug Something isn't working label Nov 30, 2023
@monaqa
Copy link
Owner

monaqa commented Nov 30, 2023

Thank you for the report.
Please try the latest revision (27eb570).

@alex-tdrn
Copy link
Author

It works perfectly for all my usecases now. Thank you so much for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants