Skip to content

Commit

Permalink
Merge pull request #567 from andocz/blame-preserve-selection
Browse files Browse the repository at this point in the history
Improve initialization of git blame view
  • Loading branch information
bruntib authored Mar 12, 2022
2 parents f32a055 + 4717d23 commit f775739
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugins/git/webgui/js/gitBlame.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ function (on, topic, declare, Color, dom, Tooltip, Text, model, viewHandler,
* @param {Integer} fileId
*/
loadBlameView : function (path, fileId) {
this.set('selection', [1,1,1,1]);
var res = model.gitservice.getRepositoryByProjectPath(path);

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

var selection = message.nodeInfo
? [
message.nodeInfo.range.range.startpos.line,
message.nodeInfo.range.range.startpos.column,
message.nodeInfo.range.range.endpos.line,
message.nodeInfo.range.range.endpos.column]
: [1, 1, 1, 1];

commitCache = {};
that.loadFile(fileInfo.id);
that.set('selection', selection);
that.jumpToPos(selection[0], selection[1]);

that.loadBlameView(fileInfo.path, fileInfo.id);

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

urlHandler.setStateValue({
center : that.id
center : that.id,
select : selection.join('|'),
fid : fileInfo.id
});
});
}
Expand Down

0 comments on commit f775739

Please sign in to comment.