kopia lustrzana https://github.com/c9/core
Merge pull request +7040 from c9/ack
Add ack support to terminal hover_linkpull/85/head
commit
635999ffee
|
@ -254,6 +254,45 @@ var HoverLink = function(editor) {
|
|||
match.value = value.replace(/:[^\d][^:]*$/, "");
|
||||
// match.basePath = "";
|
||||
}
|
||||
else if (prompt.command === "ack" || prompt.command === "ag" || prompt.command === "ack-grep") {
|
||||
match.type = "path";
|
||||
var fontColor = lineData[column] && lineData[column][0];
|
||||
if (match.start !== 0) {
|
||||
if (fontColor == session.term.defAttr)
|
||||
return;
|
||||
|
||||
var col = column;
|
||||
while (lineData[col] && lineData[col][0] == fontColor)
|
||||
col--;
|
||||
match.start = col + 1;
|
||||
col = column;
|
||||
while (lineData[col] && lineData[col][0] == fontColor)
|
||||
col++;
|
||||
match.value = line.substring(match.start, col);
|
||||
}
|
||||
|
||||
var jumpLine = line.match(/^(\d*:)?/)[0];
|
||||
var jumpColumn = Math.max(match.start - jumpLine.length, 0);
|
||||
|
||||
if (match.start == 0 && jumpLine)
|
||||
match.value = jumpLine;
|
||||
|
||||
var pathLine = line;
|
||||
while (/^\d+/.test(pathLine) && row > prompt.row) {
|
||||
lineData = session.getLineData(row);
|
||||
if (!lineData.wrapped) {
|
||||
pathLine = session.getLine(row);
|
||||
}
|
||||
row--;
|
||||
}
|
||||
|
||||
match.path = pathLine;
|
||||
if (jumpLine)
|
||||
match.path += ":" + jumpLine + jumpColumn;
|
||||
|
||||
if (match.start == 0 && jumpLine)
|
||||
match.action = "open";
|
||||
}
|
||||
else if (/^(~|\.\.?)?[\/\\]/.test(value) || /\w:[\\]/.test(value)) {
|
||||
match.type = "path";
|
||||
match.value = value.replace(/['">)}\].,;:]+$/, "");
|
||||
|
@ -325,7 +364,8 @@ var HoverLink = function(editor) {
|
|||
command: command,
|
||||
index: m.index,
|
||||
args: args,
|
||||
lineData: lineData
|
||||
lineData: lineData,
|
||||
row: row
|
||||
};
|
||||
}
|
||||
if (lineData.isUserInput)
|
||||
|
|
|
@ -127,6 +127,8 @@ define(function(require, exports, module) {
|
|||
function showMenu(e) {
|
||||
if (e.type == "link" && (tabManager.focussedTab || 0).editorType)
|
||||
return open(e);
|
||||
if (e.action == "open")
|
||||
return open(e);
|
||||
|
||||
createMenu(e);
|
||||
|
||||
|
@ -206,7 +208,7 @@ define(function(require, exports, module) {
|
|||
}
|
||||
|
||||
function buildPath(e) {
|
||||
var path = e.value;
|
||||
var path = e.path || e.value;
|
||||
var abs = false;
|
||||
|
||||
if (c9.platform == "win32") {
|
||||
|
|
Ładowanie…
Reference in New Issue