Skip to content

Commit bc03915

Browse files
committed
Jump to first non-whitespace column of other file
1 parent f061ad9 commit bc03915

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

plugins-client/ext.editors/editors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,6 @@ module.exports = ext.register("ext/editors/editors", {
10521052
var _self = this;
10531053
var tabs = tabEditors;
10541054
var row = options.row;
1055-
var column = options.column || 0;
10561055
var text = options.text;
10571056
var node = options.node;
10581057
var path = options.path || (node && node.getAttribute("path"));
@@ -1064,6 +1063,7 @@ module.exports = ext.register("ext/editors/editors", {
10641063
row -= 1;
10651064
var endRow = typeof options.endRow == "number" ? options.endRow - 1 : row;
10661065
var endColumn = options.endColumn;
1066+
var column = options.column || (options.getColumn ? options.getColumn() : 0);
10671067

10681068
ace.session.unfold({row: row, column: column || 0});
10691069
if (typeof endColumn == "number")

plugins-client/ext.language/jumptodef.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ module.exports = {
8383
});
8484
},
8585

86-
$getFirstColumn: function(path, row) {
86+
$getFirstColumn: function(row) {
8787
var editor = editors.currentEditor;
88-
if (path || !editor || editor.path != "ext/code/code" || !editor.amlEditor)
88+
if (!editor || editor.path != "ext/code/code" || !editor.amlEditor)
8989
return 0;
9090
var line = editor.getDocument().getLine(row);
9191
if (!line)
@@ -140,9 +140,14 @@ module.exports = {
140140
if (!lastResult.isDeferred)
141141
break;
142142
}
143+
144+
var _self = this;
143145
var path = lastResult.path ? ide.davPrefix.replace(/[\/]+$/, "") + "/" + lastResult.path : undefined;
146+
144147
editors.gotoDocument({
145-
column: lastResult.column !== undefined ? lastResult.column : this.$getFirstColumn(path, lastResult.row),
148+
getColumn: function() {
149+
return lastResult.column !== undefined ? lastResult.column : _self.$getFirstColumn(lastResult.row);
150+
},
146151
row: lastResult.row + 1,
147152
node: path ? undefined : tabEditors.getPage().xmlRoot,
148153
animate: true,
@@ -161,7 +166,7 @@ module.exports = {
161166
var preceding = util.retrievePreceedingIdentifier(line, cursor.column);
162167
var column = cursor.column - preceding.length;
163168
if (column === oldPos.column)
164-
column = this.$getFirstColumn(null, cursor.row);
169+
column = this.$getFirstColumn(cursor.row);
165170
var newPos = { row: cursor.row, column: column };
166171
editor.getSelection().setSelectionRange({ start: newPos, end: newPos });
167172
},

0 commit comments

Comments
 (0)