updated to v1.9

This commit is contained in:
Dan Remollino
2023-03-26 15:54:52 -04:00
parent aee287daf6
commit 1add96bccc
3 changed files with 37 additions and 16 deletions

View File

@ -1,15 +1,19 @@
## Version 1.9
- changed `Preview All Installed FIGlet Fonts` to `Generate FIGlet Font Collection Preview`
- added font collection selection for `Generate FIGlet Font Collection Preview`
## Version 1.8.1
- fixed duplicate text on every output line when indented selection was preceded by non-whitespace characters
## Version 1.8
- fixed missing font links
- added BDF and C64 font sets
- added BDF and C64 font collections
## Version 1.7.1
- removed unneeded filesystem entitlement (again)
## Version 1.7
- added 'Preview All Installed FIGlet Fonts' to Extensions menu
- added `Preview All Installed FIGlet Fonts` to Extensions menu
## Version 1.6.4
- updated README.md

View File

@ -25,8 +25,8 @@ nova.commands.register('figlet', (workspace, figletArgs, textToConvert, postConv
}
args.push(
'-d' + fontDir(),
'-f' + nova.config.get('figlet_text.font', 'string').replace(fontSubDir, ''),
'-d', fontDir(),
'-f', nova.config.get('figlet_text.font', 'string').replace(fontSubDir, ''),
textToConvert
)
@ -98,7 +98,7 @@ nova.commands.register('figletTextEditor', editor => {
// get the range of the start of the line with selection to the start of
// the selection and calculate the amount of characters for indentation
let indentRange = new Range(editor.getLineRangeForRange(range).start, range.start)
let indentText = (() => {
const indentText = (() => {
let charCount = editor.getTextInRange(indentRange).length
return ' '.repeat(charCount)
})()
@ -179,11 +179,28 @@ nova.config.onDidChange('figlet_text.previewText', (newValue, oldValue) => {
// preview all installed FIGlet distributed fonts in an new editor
nova.commands.register('figletTextFontPreviewAll', workspace => {
workspace.showActionPanel('Select a Font Collection', {buttons: ['FIGlet', 'BDF', 'C64', 'Cancel']}, actionValue => {
// panel was canceled
if (actionValue === 3) return
const fontSubDir = (() => {
switch (actionValue) {
case 0:
return ''
case 1:
return 'bdffonts'
case 2:
return 'C64-fonts'
}
})()
let message = 'Enter a custom preview text. Leave blank to use the font name for each font preview text output.'
let options = {label: 'Preview Text', placeholder: 'Use Font Name', prompt: 'Generate Previews'}
workspace.showInputPanel(message, options, value => {
if (typeof value !== 'undefined') {
const process = new Process('/usr/bin/env', {args: ['showfigfonts', value]})
workspace.showInputPanel(message, options, inputValue => {
// panel was canceled
if (typeof inputValue === 'undefined') return
const process = new Process('/usr/bin/env', {args: ['showfigfonts', '-d', '/usr/local/Cellar/figlet/2.2.5/share/figlet/fonts/' + fontSubDir, inputValue]})
let preview = ''
process.onStdout(line => {
@ -192,7 +209,7 @@ nova.commands.register('figletTextFontPreviewAll', workspace => {
process.onDidExit(status => {
if (status === 0) {
workspace.openFile(nova.fs.tempdir + '/FIGlet Text | All Fonts Preview.txt')
workspace.openFile(nova.fs.tempdir + '/FIGlet Text | Font Collection Preview.txt')
.then(editor => {
editor.edit(e => { e.insert(0, preview) })
editor.scrollToPosition(0)
@ -201,6 +218,6 @@ nova.commands.register('figletTextFontPreviewAll', workspace => {
})
process.start()
}
})
})
})

View File

@ -3,7 +3,7 @@
"name": "FIGlet Text",
"organization": "Dan Remollino",
"description": "Convert selected text to FIGlet. Great for adding readable text to the Minimap, creating l33t text headers, and organizing files.",
"version": "1.8.1",
"version": "1.9",
"categories": ["commands", "formatters"],
"entitlements": {
@ -24,7 +24,7 @@
{
"key": "figlet_text.font",
"title": "Font",
"description": "The Homebrew install of FIGlet includes three font sets...\n\nFIGlet (unprefixed): The default fonts distributed with FIGlet\nBDF (bdffonts): BDF-format (X Windows) fonts distributed by the X Consortium\nC64 (C64-fonts): Commodore 64 fonts converted by by David Proper",
"description": "The Homebrew install of FIGlet includes three font collections...\n\nFIGlet (unprefixed): The default fonts distributed with FIGlet\nBDF (bdffonts): BDF-format (X Windows) fonts distributed by the X Consortium\nC64 (C64-fonts): Commodore 64 fonts converted by by David Proper",
"type": "enum",
"radio": false,
"values": [
@ -469,7 +469,7 @@
{
"key": "figlet_text.preview",
"title": "Preview",
"description": "Admittedly, this isn't the ideal preview as Nova uses a non-monospaced output for the Preview textbox above.\n\nUse the Extensions -> Preview All Installed FIGlet Fonts menu item to generate an accurate, custom text FIGlet font preview document. This will only output the FIGlet distributed font set.",
"description": "Admittedly, this isn't the ideal preview as Nova uses non-monospaced output for the Preview textbox above.\n\nUse the Extensions -> Generate FIGlet Font Collection Preview menu item to generate an accurate, custom text FIGlet font collection preview document.",
"type": "text"
}
]
@ -564,7 +564,7 @@
],
"extensions": [
{
"title": "Preview All Installed FIGlet Fonts",
"title": "Generate FIGlet Font Collection Preview",
"command": "figletTextFontPreviewAll"
}
]