Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align gutter png icon position with line number #5611

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/css/editor-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ module.exports = `
contain: style size layout;
}

.ace_gutter {
--line-height-value: 1.2;
--icon-height: 16px;
}

.ace_gutter-active-line {
position: absolute;
left: 0;
Expand All @@ -118,6 +123,7 @@ module.exports = `
padding-left: 19px;
padding-right: 6px;
background-repeat: no-repeat;
line-height: var(--line-height-value, 1.2);
}

.ace_gutter-cell_svg-icons .ace_gutter_annotation {
Expand All @@ -133,19 +139,22 @@ module.exports = `
.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");
background-repeat: no-repeat;
background-position: 2px center;
background-position: 2px calc((1em * var(--line-height-value, 1.2) / 2 - var(--icon-height, 16px) / 2));
background-size: var(--icon-height, 16px);
}

.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");
background-repeat: no-repeat;
background-position: 2px center;
background-position: 2px calc((1em * var(--line-height-value, 1.2) / 2 - var(--icon-height, 16px) / 2));
background-size: var(--icon-height, 16px);
}

.ace_gutter-cell.ace_info, .ace_icon.ace_info {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: 2px center;
background-position: 2px calc((1em * var(--line-height-value, 1.2) / 2 - var(--icon-height, 16px) / 2));
background-size: var(--icon-height, 16px);
}
.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");
Expand Down
19 changes: 19 additions & 0 deletions src/mouse/default_gutter_handler_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
return e;
};

var editor;

Check warning on line 25 in src/mouse/default_gutter_handler_test.js

View workflow job for this annotation

GitHub Actions / build (16.x)

'editor' is assigned a value but never used

module.exports = {
setUp : function(next) {
Expand Down Expand Up @@ -106,6 +106,25 @@
assert.ok(/info test/.test(tooltip.textContent));
}, 100);
},
"test: gutter png icons" : function() {
var editor = this.editor;
var value = "";

editor.session.setMode(new Mode());
editor.setOption("useSvgGutterIcons", false);
editor.setValue(value, -1);
editor.session.setAnnotations([{row: 0, column: 0, type: "error", text: "error test"}]);
editor.renderer.$loop._flush();

var lines = editor.renderer.$gutterLayer.$lines;
var line = lines.cells[0].element;
assert.ok(/ace_gutter-cell/.test(line.className));
assert.notOk(/ace_gutter-cell_svg-icons/.test(line.className));

var annotation = line.children[2].firstChild;
assert.ok(/ace_icon/.test(annotation.className));
assert.notOk(/ace_icon_svg/.test(annotation.className));
},
"test: gutter svg icons" : function() {
var editor = this.editor;
var value = "";
Expand Down
Loading