Skip to content

Commit

Permalink
update ace
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Apr 22, 2018
1 parent 2e524ab commit 15911b3
Show file tree
Hide file tree
Showing 36 changed files with 2,730 additions and 595 deletions.
1 change: 1 addition & 0 deletions plugins/c9.ide.keys/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ define(function(require, exports, module) {
var keyUtil = require("ace/lib/keys");
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
var CommandManager = require("ace/commands/command_manager").CommandManager;
CommandManager.prototype.$checkCommandState = false;

/***** Initialization *****/

Expand Down
2 changes: 1 addition & 1 deletion plugins/c9.ide.scm/blame.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
text-align: left !important;
top: 0;
z-index: 5;
pointer-events: auto;
pointer-events: auto!important;
}
.ace_blame-cell{
border-top: solid 1px;
Expand Down
30 changes: 22 additions & 8 deletions plugins/c9.ide.scm/blame.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ var BlameGutter = function(editor, blameStr) {

this.onMousedown = this.onMousedown.bind(this);
this.onChangeEditor = this.onChangeEditor.bind(this);
this.onChangeSelection = this.onChangeSelection.bind(this);
this.onMousemove = this.onMousemove.bind(this);
this.onMouseout = this.onMouseout.bind(this);

Expand Down Expand Up @@ -212,6 +213,7 @@ var BlameGutter = function(editor, blameStr) {
this.closeButton = this.resizer.firstChild;

gutter.on("afterRender", this.drawGutter);
editor.on("changeSelection", this.onChangeSelection);
this.element.addEventListener("mousedown", this.onMousedown);
this.resizer.addEventListener("mousedown", this.onMousedown);

Expand All @@ -229,6 +231,7 @@ var BlameGutter = function(editor, blameStr) {
var editor = this.editor;
var gutter = editor.renderer.$gutterLayer;
gutter.off("afterRender", this.drawGutter);
editor.off("changeSelection", this.onChangeSelection);

editor.blameGutter = gutter.blameColumn = this.editor = null;

Expand Down Expand Up @@ -260,6 +263,20 @@ var BlameGutter = function(editor, blameStr) {
this.attachToEditor(e.editor);
};

this.onChangeSelection = function() {
var renderer = this.editor.renderer;
var row = this.session.selection.cursor.row;

var blameData = this.blameData || [];

while (!blameData[row] && row > 0) row--;
var blameCell = blameData[row];
if (blameCell) {
this.selectedHash = blameCell.data.hash;
renderer.$loop.schedule(renderer.CHANGE_GUTTER | renderer.CHANGE_MARKER);
}
};

this.drawGutter = function(e, gutter) {
var container = gutter.blameColumn.element;
var blameData = gutter.blameColumn.blameData;
Expand All @@ -268,7 +285,7 @@ var BlameGutter = function(editor, blameStr) {
var cells = gutter.$lines.cells;
var cache = gutter.blameColumn.$cache;
var cacheIndex = 0;
var offset = - getTop(gutter.element) + gutter.config.offset;
var offset = -getTop(gutter.element);

var commit;
for (var i = 0; i < cells.length; i++) {
Expand All @@ -280,11 +297,6 @@ var BlameGutter = function(editor, blameStr) {
// find first row
while (!blameData[row] && row > 0) row--;
data = blameData[row]
commit = {
row: row,
cell: cell,
data: data,
};
}

if (!data)
Expand All @@ -299,7 +311,7 @@ var BlameGutter = function(editor, blameStr) {
data: data,
};
}
if (commit.cell == cell)
if (commit)
add(commit.data, commit.row, commit.cell);

function add(data, row, firstCell, nextCell) {
Expand All @@ -310,7 +322,7 @@ var BlameGutter = function(editor, blameStr) {
el.index = row;
el.textContent = data.text + " " + data.title;

var top = getTop(firstCell.element) - offset;
var top = Math.max(getTop(firstCell.element) - offset, 0);
var next = nextCell ? getTop(nextCell.element) - offset : gutter.config.height;
el.style.top = top + "px";
el.style.height = next - top + "px";
Expand Down Expand Up @@ -362,6 +374,8 @@ var BlameGutter = function(editor, blameStr) {
var blameCell = blameData[target.index];
if (!blameCell)
return event.stopEvent(e);
var pos = this.editor.renderer.screenToTextCoordinates(e.clientX, e.clientY);
this.editor.selection.moveToPosition(pos);
gutter.blameColumn.selectedHash = blameCell.data.hash;
this.editor.renderer.$loop.schedule(this.editor.renderer.CHANGE_GUTTER);
return event.stopEvent(e);
Expand Down
5 changes: 4 additions & 1 deletion plugins/node_modules/ace/lib/ace/commands/command_manager.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions plugins/node_modules/ace/lib/ace/commands/command_manager_test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions plugins/node_modules/ace/lib/ace/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions plugins/node_modules/ace/lib/ace/edit_session.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion plugins/node_modules/ace/lib/ace/ext/language_tools.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion plugins/node_modules/ace/lib/ace/ext/modelist.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion plugins/node_modules/ace/lib/ace/ext/options.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions plugins/node_modules/ace/lib/ace/keyboard/textinput.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/node_modules/ace/lib/ace/layer/gutter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion plugins/node_modules/ace/lib/ace/layer/lines.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/node_modules/ace/lib/ace/lib/dom.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 15911b3

Please sign in to comment.