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

Indenting: Initial indent setting not getting set when doc is opened #1106

Closed
cgchoffman opened this Issue Feb 25, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@cgchoffman
Member

cgchoffman commented Feb 25, 2016

Short Summary

I can only reproduce this on Windows so far. I open a file and run require("ko/editor").scimoz().indent and the result is 0. This results in cmd_backSmart failing as a division by zero error occurs.

@Naatan thinks that it's his refactoring of koDocument.py which removed cases where prefs were implicitly set.

As soon as you use your Tab key to create an indent the setting is set and the issue goes away.

@cgchoffman cgchoffman added this to the 9.3.3 milestone Feb 25, 2016

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Feb 25, 2016

Note: prefs.xml file to reproduce the issue was dropped into slack for @Naatan

@mitchell-as

This comment has been minimized.

Member

mitchell-as commented Feb 25, 2016

Just so you know, Scintilla has two indent-type options: scimoz.tabWidth and scimoz.indent. tabWidth is exactly what you think, the width of a tab in spaces. indent is a bit different (but I'm not exactly sure how), but it is allowed to be zero. When it it zero, Scintilla internally uses tabWidth. Therefore any time you are asking scimoz for tab width, you must use tabWidth and not indent, or else you'll get division by zero.

@Naatan Naatan changed the title from Indenting: Intial indent setting not getting set when doc is opened to Indenting: Initial indent setting not getting set when doc is opened Feb 25, 2016

@Naatan

This comment has been minimized.

Member

Naatan commented Feb 25, 2016

@cgchoffman

This comment has been minimized.

Member

cgchoffman commented Feb 25, 2016

Thanks @mitchell-as, useful info.

@Naatan Naatan added the New label Mar 14, 2016

@mitchell-as mitchell-as assigned mitchell-as and unassigned Naatan Mar 14, 2016

mitchell-as added a commit that referenced this issue Mar 14, 2016

fix: editor: Fix potential division by zero error in smart backspace -
…fixes #1106

rn=

(integrated from master branch change 9.2.1-1062-g5279e3b by Mitchell <mitchellb@activestate.com>)
@mitchell-as

This comment has been minimized.

Member

mitchell-as commented Mar 14, 2016

Just FYI, as indicated in my comments above, scimoz().indent == 0 is perfectly valid. We just need to handle it properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment