Skip to content

Commit f775739

Browse files
authored
Merge pull request #567 from andocz/blame-preserve-selection
Improve initialization of git blame view
2 parents f32a055 + 4717d23 commit f775739

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

plugins/git/webgui/js/gitBlame.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ function (on, topic, declare, Color, dom, Tooltip, Text, model, viewHandler,
204204
* @param {Integer} fileId
205205
*/
206206
loadBlameView : function (path, fileId) {
207-
this.set('selection', [1,1,1,1]);
208207
var res = model.gitservice.getRepositoryByProjectPath(path);
209208

210209
if (!res.isInRepository)
@@ -250,14 +249,27 @@ function (on, topic, declare, Color, dom, Tooltip, Text, model, viewHandler,
250249
if (!fileInfo)
251250
return;
252251

252+
var selection = message.nodeInfo
253+
? [
254+
message.nodeInfo.range.range.startpos.line,
255+
message.nodeInfo.range.range.startpos.column,
256+
message.nodeInfo.range.range.endpos.line,
257+
message.nodeInfo.range.range.endpos.column]
258+
: [1, 1, 1, 1];
259+
253260
commitCache = {};
254261
that.loadFile(fileInfo.id);
262+
that.set('selection', selection);
263+
that.jumpToPos(selection[0], selection[1]);
264+
255265
that.loadBlameView(fileInfo.path, fileInfo.id);
256266

257267
topic.publish('codecompass/setCenterModule', that.id);
258268

259269
urlHandler.setStateValue({
260-
center : that.id
270+
center : that.id,
271+
select : selection.join('|'),
272+
fid : fileInfo.id
261273
});
262274
});
263275
}

0 commit comments

Comments
 (0)