Permalink
Browse files

Fixed go to next/previous error

  • Loading branch information...
1 parent 65b74ff commit 23b64052bb67e523ca64e5fdaf7200945a4397e2 @mvoidex mvoidex committed Apr 13, 2013
Showing with 12 additions and 4 deletions.
  1. +5 −0 Default.sublime-keymap
  2. +7 −4 parseoutput.py
View
@@ -25,5 +25,10 @@
"command": "sublime_haskell_previous_error",
"keys": ["alt+shift+d", "alt+shift+e"],
"context": [ { "key": "is_haskell_source" } ]
+ },
+ {
+ "keys": ["ctrl+alt+e"],
+ "command": "show_panel",
+ "args": { "panel": "output.haskell_error_checker" }
}
]
View
@@ -223,15 +223,16 @@ def run(self, edit):
v = self.view
fn = v.file_name().encode("utf-8")
line, column = v.rowcol(v.sel()[0].a)
+ line += 1
gotoline = -1
if fn in ERRORS:
- for errLine in ERRORS[fn]:
+ for errLine in sorted(ERRORS[fn].keys()):
if errLine > line:
gotoline = errLine
break
# No next line: Wrap around if possible
if gotoline == -1 and len(ERRORS[fn]) > 0:
- gotoline = ERRORS[fn].keys()[0]
+ gotoline = sorted(ERRORS[fn].keys())[0]
if gotoline != -1:
v.window().open_file("%s:%d" % (fn, gotoline), sublime.ENCODED_POSITION)
else:
@@ -243,14 +244,16 @@ def run(self, edit):
v = self.view
fn = v.file_name().encode("utf-8")
line, column = v.rowcol(v.sel()[0].a)
+ line += 1
gotoline = -1
if fn in ERRORS:
- for errLine in ERRORS[fn]:
+ for errLine in sorted(ERRORS[fn].keys(), key = lambda x: -x):
if errLine < line:
gotoline = errLine
+ break
# No previous line: Wrap around if possible
if gotoline == -1 and len(ERRORS[fn]) > 0:
- gotoline = ERRORS[fn].keys()[-1]
+ gotoline = sorted(ERRORS[fn].keys())[-1]
if gotoline != -1:
v.window().open_file("%s:%d" % (fn, gotoline), sublime.ENCODED_POSITION)
else:

0 comments on commit 23b6405

Please sign in to comment.