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

scale plugin error attempt to index local 'text' (a nil value) #113

Open
pergus opened this issue Dec 27, 2020 · 0 comments
Open

scale plugin error attempt to index local 'text' (a nil value) #113

pergus opened this issue Dec 27, 2020 · 0 comments

Comments

@pergus
Copy link

pergus commented Dec 27, 2020

Changing the font size when there is only one line of text in a file generates an error:
data/core/common.lua:11 attempt to index local 'text' (a nil value)

Workaround:
Add a check to make sure that (n - view.size.y) isn't zero before line 51 in function set_scale to prevent a division by zero error.

Change:

   if n ~= math.huge and not view:is(CommandView) then
      scrolls[view] = view.scroll.y / (n - view.size.y)
    end

To:

    if n ~= math.huge and not view:is(CommandView) then
      if (n - view.size.y) ~= 0 then
        scrolls[view] = view.scroll.y / (n - view.size.y)
      end
    end
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

No branches or pull requests

1 participant