Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Sense: Move to first request upon open
Browse files Browse the repository at this point in the history
  • Loading branch information
bleskes committed Mar 11, 2014
1 parent 7809042 commit d85ddb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion sense/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ define([
}
$.ajax(loadFrom).done(function (data) {
resetToValues(defaultHost, data);
input.moveToNextRequestEdge(true);
input.highlightCurrentRequestAndUpdateActionBar();
input.updateActionsBar();
});
Expand All @@ -139,7 +140,7 @@ define([
else {
resetToValues(defaultHost);
}

input.moveToNextRequestEdge(true);
}());

(function setupAutosave() {
Expand Down
7 changes: 5 additions & 2 deletions sense/app/sense_editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,13 @@ define([
editor.moveCursorTo(pos.row, 0);
});

editor.moveToNextRequestEdge = onceDoneTokenizing(function () {
editor.moveToNextRequestEdge = onceDoneTokenizing(function (moveOnlyIfNotOnEdge) {
var pos = editor.getCursorPosition();
var maxRow = editor.getSession().getLength();
for (pos.row++; pos.row < maxRow && !editor.parser.isRequestEdge(pos.row); pos.row++) {
if (!moveOnlyIfNotOnEdge) {
pos.row++;
}
for (; pos.row < maxRow && !editor.parser.isRequestEdge(pos.row); pos.row++) {
}
editor.moveCursorTo(pos.row, 0);
});
Expand Down

0 comments on commit d85ddb4

Please sign in to comment.