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

Set indentation to 0 causing errors #1009

Closed
joshringer opened this Issue Jan 15, 2016 · 2 comments

Comments

Projects
None yet
4 participants
@joshringer

joshringer commented Jan 15, 2016

Seen on: Komodo Edit, version 9.3.2, build 16460, platform win32-x86.
Built on Thu Dec 10 22:21:38 2015.

While trying to figure out what turned out to be issue #875, I set the number of spaces indentation setting in current file preferences to 0 (by clearing the box and hitting 'ok'; attempting what I thought might be "inherit from main preferences").
This causes issues that manifest themselves as being unable to dedent a code section by pressing backspace, as it will raise an exception (unsurprisingly the result of a div by 0 error) such as this:

ERROR:xpcom:Unhandled exception calling 'int8 * doCommand(in string);'
Traceback (most recent call last):
  File "C:\Program Files (x86)\ActiveState Komodo Edit 9\lib\mozilla\python\xpcom\server\policy.py", line 300, in _CallMethod_
    return 0, func(*params)
  File "C:\Program Files (x86)\ActiveState Komodo Edit 9\lib\mozilla\components\koLanguageCommandHandler.py", line 726, in doCommand
    meth()
  File "C:\Program Files (x86)\ActiveState Komodo Edit 9\lib\mozilla\components\koLanguageCommandHandler.py", line 1677, in _do_cmd_backSmart
    want = int((have - 1) / indentwidth) * indentwidth
ZeroDivisionError: integer division or modulo by zero
[2016-01-15 14:29:16,937] [ERROR] commands: An error occurred executing the cmd_backSmart command
-- EXCEPTION START --
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIController.doCommand]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://xtk/content/controller.js :: ForwardingController_doCommand :: line 233"  data: no]
+ toString (function) 3 lines
+ message (string) 'Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIController.doCommand]'
+ result (number) 2147500037
+ name (string) 'NS_ERROR_FAILURE'
+ filename (string) 'chrome://xtk/content/controller.js'
+ lineNumber (number) 233
+ columnNumber (number) 0
+ inner (object) null
| + data (object) null
| + stack (string) 'ForwardingController_doCommand@chrome://xtk/content/controller.js:233:4
command_doCommand@chrome://k'...475 chars
+ location (object) JS frame :: chrome://xtk/content/controller.js :: ForwardingController_doCommand :: line 233
| + QueryInterface (function) 3 lines
| + language (number) 2
| + languageName (string) 'JavaScript'
| + filename (string) 'chrome://xtk/content/controller.js'
| + name (string) 'ForwardingController_doCommand'
| + lineNumber (number) 233
| + columnNumber (number) 4
| + sourceLine (string) ''
| + caller (object) JS frame :: chrome://komodo/content/library/commands.js :: command_doCommand :: line 263
| + formattedStack (string) 'ForwardingController_doCommand@chrome://xtk/content/controller.js:233:4
command_doCommand@chrome://k'...475 chars
| + stack
    ForwardingController_doCommand@chrome://xtk/content/controller.js:233:4
    command_doCommand@chrome://komodo/content/library/commands.js:263:0
    @chrome://komodo/content/keybindings/keybindings.js line 2488 > eval:1:0
    this.Manager.prototype.evalCommand@chrome://komodo/content/keybindings/keybindings.js:2488:22
    this.Manager.prototype.keypressHandler@chrome://komodo/content/keybindings/keybindings.js:2657:16
    gKeyHandler@chrome://komodo/content/keybindings/keybindings.js:2543:4
-- EXCEPTION END --

@mitchell-as mitchell-as added this to the 9.3.x milestone Jan 15, 2016

@mitchell-as

This comment has been minimized.

Member

mitchell-as commented Jan 15, 2016

Thanks for the report.

@Naatan

This comment has been minimized.

Member

Naatan commented Jan 15, 2016

The issue here is we should outright not accept 0 as a setting.

@Naatan Naatan modified the milestones: 9.3.x, 9.3.3 Jan 19, 2016

mitchell-as added a commit that referenced this issue Jan 25, 2016

fix: prefs: Prevent tab width from being set to zero - fixes #1009
This will prevent division by zero errors later.

rn=

(integrated from master branch change 9.2.1-801-g91c6e71 by Mitchell <mitchellb@activestate.com>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment