From 2b7a830594288bc277a791f8cccb37fa9af91696 Mon Sep 17 00:00:00 2001 From: Alice Koreman Date: Fri, 30 Aug 2024 15:27:50 +0200 Subject: [PATCH] fix: apply padding to right side multi-line markers --- src/layer/marker.js | 4 ++-- src/marker_group_test.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layer/marker.js b/src/layer/marker.js index 935e1b8a4c4..3307c7b89b9 100644 --- a/src/layer/marker.js +++ b/src/layer/marker.js @@ -165,7 +165,7 @@ class Marker { } else { this.elt( clazz + " ace_br1 ace_start", - "height:"+ height+ "px;"+ "right:0;"+ "top:"+top+ "px;left:"+ left+ "px;" + (extraStyle || "") + "height:"+ height+ "px;"+ "right:" + padding + "px;"+ "top:"+top+ "px;left:"+ left+ "px;" + (extraStyle || "") ); } // from start of the last line to the selection end @@ -197,7 +197,7 @@ class Marker { this.elt( clazz + (radiusClass ? " ace_br" + radiusClass : ""), "height:"+ height+ "px;"+ - "right:0;"+ + "right:" + padding + "px;"+ "top:"+ top+ "px;"+ "left:"+ padding+ "px;"+ (extraStyle || "") ); diff --git a/src/marker_group_test.js b/src/marker_group_test.js index 6e65fd3d50d..f8006daab88 100644 --- a/src/marker_group_test.js +++ b/src/marker_group_test.js @@ -114,8 +114,8 @@ module.exports = { assert.equal(markerSize.height, lineHeight); // Should start at the 13th character (including 4px offset) assert.equal(markerSize.left, 12 * characterWidth + 4); - // Shoud be as wide as the marker layer - 12 characters and the offset. - assert.equal(markerSize.width, editor.renderer.$markerBack.element.getBoundingClientRect().width - 12 * characterWidth - 4); + // Shoud be as wide as the marker layer - 12 characters and the offset on both sides. + assert.equal(markerSize.width, editor.renderer.$markerBack.element.getBoundingClientRect().width - 12 * characterWidth - 4 - 4); }, "test: should default to markers of text type": function() { editor.resize(true);