updated to v1.10.1

This commit is contained in:
Dan Remollino
2023-03-27 18:17:17 -04:00
parent eecbd369d6
commit c5809ab773
3 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,6 @@
## Version 1.10.1
- fixed right border not vertically aligning for some characters
## Version 1.10 ## Version 1.10
- added Borders option to add custom borders - added Borders option to add custom borders
- added Padding option to adjust spacing between outputted text and borders - added Padding option to adjust spacing between outputted text and borders

View File

@ -149,18 +149,20 @@ nova.commands.register('figletTextEditor', editor => {
switch (border) { switch (border) {
case 'left': case 'left':
figletTextArr = figletTextArr.map(line => { figletTextArr = figletTextArr.map(line => {
if (!/^\s+$/.test(line)) return `${' '.repeat(borders[border].padding)}${line}` if (!/^\s+$/.test(line)) return `${' '.repeat(borders.left.padding)}${line}`
}) })
break break
case 'right': case 'right':
figletTextArr = figletTextArr.map(line => { figletTextArr = figletTextArr.map(line => {
if (!/^\s+$/.test(line)) return `${line}${' '.repeat(borders[border].padding)}` let additionalRightPadding = (borders.left.padding + longestLine + borders.right.padding) - (borders.left.padding + line.length + borders.right.padding)
if ( additionalRightPadding > 0) line = `${line}${' '.repeat(additionalRightPadding)}`
if (!/^\s+$/.test(line)) return `${line}${' '.repeat(borders.right.padding)}`
}) })
break break
case 'top': case 'top':
if (borders.left.width === 0 && borders.right.width === 0) { if (borders.left.width === 0 && borders.right.width === 0) {
// subtract one; will Array.prototype.join('\n') before final editor output // subtract one; will Array.prototype.join('\n') before final editor output
borderBuffer.paddingTop.push([`${'\n'.repeat(borders[border].padding - 1)}`]) borderBuffer.paddingTop.push([`${'\n'.repeat(borders.top.padding - 1)}`])
} else { } else {
for (let count = borders.top.padding; count; count--) { for (let count = borders.top.padding; count; count--) {
borderBuffer.paddingTop.push( borderBuffer.paddingTop.push(
@ -172,7 +174,7 @@ nova.commands.register('figletTextEditor', editor => {
case 'bottom': case 'bottom':
if (borders.left.width === 0 && borders.right.width === 0) { if (borders.left.width === 0 && borders.right.width === 0) {
// subtract one; will Array.prototype.join('\n') before final editor output // subtract one; will Array.prototype.join('\n') before final editor output
borderBuffer.paddingBottom.push([`${'\n'.repeat(borders[border].padding - 1)}`]) borderBuffer.paddingBottom.push([`${'\n'.repeat(borders.bottom.padding - 1)}`])
} else { } else {
for (let count = borders.bottom.padding; count; count--) { for (let count = borders.bottom.padding; count; count--) {
borderBuffer.paddingBottom.push( borderBuffer.paddingBottom.push(

View File

@ -3,7 +3,7 @@
"name": "FIGlet Text", "name": "FIGlet Text",
"organization": "Dan Remollino", "organization": "Dan Remollino",
"description": "Convert selected text to FIGlet. Great for adding readable text to the Minimap, creating l33t text headers, and organizing files.", "description": "Convert selected text to FIGlet. Great for adding readable text to the Minimap, creating l33t text headers, and organizing files.",
"version": "1.10", "version": "1.10.1",
"categories": ["commands", "formatters"], "categories": ["commands", "formatters"],
"entitlements": { "entitlements": {