Skip to content

Commit 19344a3

Browse files
authored
Merge branch 'phcode-dev:main' into main
2 parents d0114ab + 94a85c5 commit 19344a3

File tree

12 files changed

+105
-30
lines changed

12 files changed

+105
-30
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "phoenix",
3-
"version": "4.0.0-0",
4-
"apiVersion": "4.0.0",
3+
"version": "4.0.1-0",
4+
"apiVersion": "4.0.1",
55
"homepage": "https://core.ai",
66
"issues": {
77
"url": "https://github.com/phcode-dev/phoenix/issues"
@@ -118,4 +118,4 @@
118118
"tinycolor2": "^1.4.2",
119119
"underscore": "^1.13.4"
120120
}
121-
}
121+
}

src-node/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@phcode/node-core",
33
"description": "Phoenix Node Core",
4-
"version": "4.0.0-0",
5-
"apiVersion": "4.0.0",
4+
"version": "4.0.1-0",
5+
"apiVersion": "4.0.1",
66
"keywords": [],
77
"author": "arun@core.ai",
88
"homepage": "https://github.com/phcode-dev/phoenix",
@@ -28,4 +28,4 @@
2828
"cross-spawn": "^7.0.6",
2929
"which": "^2.0.1"
3030
}
31-
}
31+
}

src/LiveDevelopment/LiveDevMultiBrowser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ define(function (require, exports, module) {
588588

589589
// reload the page if the given document is a JS file related
590590
// to the current live document.
591-
if (_liveDocument.isRelated(absolutePath)) {
591+
if (_liveDocument.isRelated && _liveDocument.isRelated(absolutePath)) {
592592
if (doc.getLanguage().getId() === "javascript") {
593593
_setStatus(STATUS_RELOADING);
594594
_protocol.reload();
@@ -610,7 +610,7 @@ define(function (require, exports, module) {
610610

611611
var absolutePath = doc.file.fullPath;
612612

613-
if (_liveDocument.isRelated(absolutePath)) {
613+
if (_liveDocument.isRelated && _liveDocument.isRelated(absolutePath)) {
614614
// Set status to out of sync if dirty. Otherwise, set it to active status.
615615
_setStatus(_docIsOutOfSync(doc) ? STATUS_OUT_OF_SYNC : STATUS_ACTIVE);
616616
}

src/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"bugsnagEnv": "development"
3838
},
3939
"name": "Phoenix Code",
40-
"version": "4.0.0-0",
41-
"apiVersion": "4.0.0",
40+
"version": "4.0.1-0",
41+
"apiVersion": "4.0.1",
4242
"homepage": "https://core.ai",
4343
"issues": {
4444
"url": "https://github.com/phcode-dev/phoenix/issues"

src/extensions/default/CodeFolding/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ define(function (require, exports, module) {
4949
GUTTER_NAME = "CodeMirror-foldgutter",
5050
CODE_FOLDING_GUTTER_PRIORITY = Editor.CODE_FOLDING_GUTTER_PRIORITY,
5151
codeFoldingMenuDivider = "codefolding.divider",
52-
collapseKey = "Ctrl-Shift-[",
53-
expandKey = "Ctrl-Shift-]";
52+
collapseKey = "Ctrl-Shift-{",
53+
expandKey = "Ctrl-Shift-}";
5454

5555
ExtensionUtils.loadStyleSheet(module, "main.less");
5656

@@ -413,8 +413,8 @@ define(function (require, exports, module) {
413413
Menus.getMenu(Menus.AppMenuBar.VIEW_MENU).addMenuItem(EXPAND);
414414

415415
//register keybindings
416-
KeyBindingManager.addBinding(COLLAPSE, [{key: collapseKey}]);
417-
KeyBindingManager.addBinding(EXPAND, [{key:expandKey}]);
416+
KeyBindingManager.addBinding(COLLAPSE, [{key: collapseKey}, {key: collapseKey, platform: "mac"}]);
417+
KeyBindingManager.addBinding(EXPAND, [{key:expandKey}, {key:expandKey, platform: "mac"}]);
418418

419419

420420
// Add gutters & restore saved expand/collapse state in all currently open editors

src/extensions/default/Git/src/GutterManager.js

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,45 @@ define(function (require, exports) {
2121
editorsWithGutters = [],
2222
openWidgets = [];
2323

24+
/**
25+
* Checks if there's already a gutter marker on the given line;
26+
* if not, inserts a blank <div> to prevent an empty gutter spot.
27+
*/
28+
function _addDummyGutterMarkerIfNotExist(cm, line) {
29+
var lineInfo = cm.lineInfo(line);
30+
if (!lineInfo) {
31+
return; // If line is out of range or doc is empty
32+
}
33+
var gutters = cm.getOption("gutters").slice(0),
34+
gutterEnabled = gutters.indexOf(gutterName);
35+
if(gutterEnabled === -1){
36+
return;
37+
}
38+
var gutterMarkers = lineInfo.gutterMarkers;
39+
var existingMarker = gutterMarkers && gutterMarkers[gutterName];
40+
if (!existingMarker) {
41+
var dummy = document.createElement("div");
42+
dummy.className = "CodeMirror-gitGutter-none";
43+
cm.setGutterMarker(line, gutterName, dummy);
44+
}
45+
}
46+
47+
function _cursorActivity(_evt, editor){
48+
// this is to prevent a gutter gap in the active line if there is no color on this line.
49+
_addDummyGutterMarkerIfNotExist(editor._codeMirror, editor.getCursorPos().line);
50+
}
51+
52+
EditorManager.on("activeEditorChange", function (event, newEditor, oldEditor) {
53+
if(newEditor){
54+
newEditor.off("cursorActivity.gitGutter");
55+
newEditor.on("cursorActivity.gitGutter", _cursorActivity);
56+
_cursorActivity(null, newEditor);
57+
}
58+
if(oldEditor){
59+
oldEditor.off("cursorActivity.gitGutter");
60+
}
61+
});
62+
2463
function clearWidgets() {
2564
var lines = openWidgets.map(function (mark) {
2665
var w = mark.lineWidget;
@@ -102,7 +141,7 @@ define(function (require, exports) {
102141
.html("&nbsp;");
103142
cm.setGutterMarker(obj.line, gutterName, $marker[0]);
104143
});
105-
144+
_cursorActivity(null, editor);
106145
// reopen widgets that were opened before refresh
107146
openBefore.forEach(function (obj) {
108147
gutterClick(obj.cm, obj.line, gutterName);
@@ -373,7 +412,18 @@ define(function (require, exports) {
373412
}
374413
});
375414

415+
function init() {
416+
const editor = EditorManager.getActiveEditor();
417+
if(!editor){
418+
return;
419+
}
420+
editor.off("cursorActivity.gitGutter");
421+
editor.on("cursorActivity.gitGutter", _cursorActivity);
422+
_cursorActivity(null, editor);
423+
}
424+
376425
// API
426+
exports.init = init;
377427
exports.goToPrev = goToPrev;
378428
exports.goToNext = goToNext;
379429
});

src/extensions/default/Git/src/Panel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ define(function (require, exports) {
10831083
if ($this.attr("x-status") === Git.FILE_STATUS.DELETED) {
10841084
return;
10851085
}
1086-
FileViewController.addToWorkingSetAndSelect(Preferences.get("currentGitRoot") + $this.attr("x-file"));
1086+
FileViewController.openFileAndAddToWorkingSet(Preferences.get("currentGitRoot") + $this.attr("x-file"));
10871087
});
10881088

10891089
}
@@ -1316,6 +1316,7 @@ define(function (require, exports) {
13161316
toggle(true);
13171317
}
13181318
_panelResized();
1319+
GutterManager.init();
13191320
} // function init() {
13201321

13211322
function enable() {

src/extensions/default/Git/src/Utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ define(function (require, exports, module) {
273273
}
274274

275275
// create entry for temporary file
276-
var fileEntry = FileSystem.getFileForPath(folder + ".bracketsGitTemp");
276+
var fileEntry = FileSystem.getFileForPath(folder + ".phoenixGitTemp");
277277

278278
function finish(bool) {
279279
// delete the temp file and resolve

src/extensions/default/Git/src/git/GitCli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,10 @@ define(function (require, exports) {
606606
} else {
607607
return new Promise(function (resolve, reject) {
608608
// FUTURE: maybe use git commit --file=-
609-
var fileEntry = FileSystem.getFileForPath(Preferences.get("currentGitRoot") + ".bracketsGitTemp");
609+
var fileEntry = FileSystem.getFileForPath(Preferences.get("currentGitRoot") + ".phoenixGitTemp");
610610
jsPromise(FileUtils.writeText(fileEntry, message))
611611
.then(function () {
612-
args.push("-F", ".bracketsGitTemp");
612+
args.push("-F", ".phoenixGitTemp");
613613
return git(args, {progressTracker});
614614
})
615615
.then(function (res) {

src/extensions/default/Git/styles/git-styles.less

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
// common
44
@git-moreDarkGrey: #868888;
55
@git-green: #91CC41;
6+
@dark-git-green: #78A336;
67
@git-red: #F74687;
8+
@dark-git-red: #D03A6F;
79
@git-red-text: #F74687;
810
@git-blue-text: #1976DD;
911
@git-dark-blue-text: #51c0ff;
1012
@git-orange: #E3B551;
13+
@dark-git-orange: #C29844;
1114
@git-orange-text: #e28200;
1215

1316
// Diff colors ('d' for 'dark', `l` for "light")
@@ -291,41 +294,58 @@
291294

292295
.CodeMirror {
293296
.brackets-git-gutter {
297+
pointer-events: auto;
294298
width: @gutterWidth;
295-
margin-left: 1px;
296299
}
297300
.brackets-git-gutter-added,
298301
.brackets-git-gutter-modified,
299302
.brackets-git-gutter-removed {
303+
pointer-events: auto;
300304
background-size: @gutterWidth @gutterWidth;
301305
background-repeat: no-repeat;
302-
font-size: 1em;
303-
font-weight: bold;
304306
color: @bc-menu-bg;
305307

308+
border-left: 0.4em solid transparent;
309+
transition: border-left-width 0.2s ease;
306310
.dark & {
307311
color: @dark-bc-menu-bg;
312+
border-left-width: 0.3em;
308313
}
309314
}
310315
.brackets-git-gutter-added {
311-
background-color: @git-green;
316+
border-left-color: @git-green;
317+
.dark & {
318+
border-left-color: @dark-git-green;
319+
}
312320
}
313321

314322
.brackets-git-gutter-modified {
315-
background-color: @git-orange;
323+
border-left-color: @git-orange;
324+
&:hover {
325+
border-left-width: 2em;
326+
}
327+
.dark & {
328+
border-left-color: @dark-git-orange;
329+
}
316330
}
317331

318332
.brackets-git-gutter-removed {
319-
background-color: @git-red;
333+
border-left-color: @git-red;
334+
&:hover {
335+
border-left-width: 2em;
336+
}
337+
.dark & {
338+
border-left-color: @dark-git-red;
339+
}
320340
}
321341

322342
.brackets-git-gutter-deleted-lines {
323343
color: @bc-text;
324-
background-color: lighten(@git-red, 25%);
344+
border-left-color: lighten(@git-red, 25%);
325345
.selectable-text();
326346

327347
.dark & {
328-
background-color: darken(@git-red, 25%);
348+
border-left-color: darken(@dark-git-red, 25%);
329349
color: @dark-bc-text;
330350
}
331351

@@ -338,6 +358,10 @@
338358
height: 1.2em;
339359
line-height: 0.5em;
340360
}
361+
362+
&:hover {
363+
border-left-width: 1em;
364+
}
341365
}
342366
}
343367

@@ -814,7 +838,7 @@
814838

815839
// main
816840

817-
@gutterWidth: 0.65em; // using ems so that it'll be scalable on cmd +/-
841+
@gutterWidth: 1em; // using ems so that it'll be scalable on cmd +/-
818842

819843
#editor-holder {
820844
.git.spinner {

0 commit comments

Comments
 (0)