From 9c369f162643d259db91f1cb4eb71018690b0382 Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 27 Aug 2021 13:54:54 -0400 Subject: [PATCH] Handle files with leading at signs, update README --- README.md | 9 +-------- lsix | 9 +++++++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e319fa3..a7ad12e 100644 --- a/README.md +++ b/README.md @@ -167,13 +167,6 @@ GitHub. will be removed once xterm can handle images greater than 1000x1000. [Last tested with XTerm(344)]. -* Filenames that begin with "@" are special to ImageMagick and it'll - freak out if you don't prepend a directory. (`lsix ./@foo.png`) - (This is a bug in ImageMagick, not lsix). - -* Specifying the empty string `""` as a filename makes ImageMagick hang. - (This appears to be an ImageMagick bug / misfeature). - * Long filenames are wrapped, but not intelligently. Would it complicate this script too much to make it prefer to wrap on whites space, dashes, underscores, and periods? Maybe. @@ -274,4 +267,4 @@ GitHub. * [VT340 Test](https://github.com/hackerb9/vt340test), a project to document the actual behaviour of the DEC VT340 hardware. - * [Digital ANSI-Compliant Printing Protocol: Level 2 Programming Reference Manual](http://www.vaxhaven.com/images/f/f7/EK-PPLV2-PM-B01.pdf), Chapter 5: Sixel Graphics. An excellent and reasonably clear discussion for anyone who wants to generate or parse sixel graphics. \ No newline at end of file + * [Digital ANSI-Compliant Printing Protocol: Level 2 Programming Reference Manual](http://www.vaxhaven.com/images/f/f7/EK-PPLV2-PM-B01.pdf), Chapter 5: Sixel Graphics. An excellent and reasonably clear discussion for anyone who wants to generate or parse sixel graphics. diff --git a/lsix b/lsix index 0a11a57..9e9a0a0 100755 --- a/lsix +++ b/lsix @@ -234,14 +234,19 @@ main() { len=${#onerow[@]} onerow[len++]="-label" onerow[len++]=$(processlabel "$1") - onerow[len++]="file://$1" + onerow[len++]="file://$(imescape $1)" shift done - montage "${onerow[@]}" $imoptions gif:- \ + + montage "${onerow[@]}" $imoptions gif:- \ | convert - -colors $numcolors sixel:- done } +imescape() { + echo "$@" | sed -e 's|^@|./@|g;' +} + processlabel() { # This routine is all about appeasing ImageMagick. # 1. Remove silly [0] suffix and : prefix.