Coder Social home page Coder Social logo

ascii-boxes / boxes Goto Github PK

View Code? Open in Web Editor NEW
574.0 574.0 78.0 3.14 MB

Command line ASCII boxes unlimited!

Home Page: https://boxes.thomasjensen.com/

License: GNU General Public License v3.0

Makefile 3.69% C 86.21% Shell 3.28% Lex 2.44% Yacc 1.97% Vim Script 2.42%
ascii ascii-art ascii-graphics command-line filter

boxes's People

Contributors

bdimych avatar bryant1410 avatar carnil avatar chorpler avatar davidy22 avatar livibetter avatar mathomp4 avatar meyer avatar mike-woolley avatar residualmind avatar rickyson96 avatar schallee avatar schievel1 avatar scyptnex avatar sgn avatar smcameron avatar tajmone avatar tsjensen avatar zerotao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boxes's Issues

Boxes could handle escape sequences (especially for colors and box characters) better

My submitted answer on StackExchange for someone who wanted color text and color box borders could have been better.

Apparently, boxes does not handle colored text very well.

 printf "$(tput setaf 4)Love Unix & Linux$(tput sgr 0)" | boxes -d stone -p a2v1 
+---------------------------------+
|                                 |
|  Love Unix & Linux  |
|                                 |
+---------------------------------+

So what caused this fail? cat -A explains it all.

 printf "$(tput setaf 4)Love Unix & Linux$(tput sgr 0)" | boxes -d stone -p a2v1 | cat -A
+---------------------------------+$
|                                 |$
|  ^[[34mLove Unix & Linux^[(B^[[0m  |$
|                                 |$
+---------------------------------+$

boxes will read the escape characters and include them as the length of the text. This should not happen.

And don't get me started on what it looks like if you pipe lolcat -f between the printf or echo statement and the boxes command.

This brings up what happens if you try to do the same with box characters, which I had hoped to include as part of my own box designs. However if this is happening

printf "▁▂▃▄▅▆▇▇▆▅▄▃▂▁" | boxes -d stone -p a2v1
+----------------------------------------------+
|                                              |
|  ▁▂▃▄▅▆▇▇▆▅▄▃▂▁  |
|                                              |
+----------------------------------------------+

because cat -A says this is how it is being interpreted

 printf "▁▂▃▄▅▆▇▇▆▅▄▃▂▁" | boxes -d stone -p a2v1 | cat -A
+----------------------------------------------+$
|                                              |$
|  M-bM-^VM-^AM-bM-^VM-^BM-bM-^VM-^CM-bM-^VM-^DM-bM-^VM-^EM-bM-^VM-^FM-bM-^VM-^GM-bM-^VM-^GM-bM-^VM-^FM-bM-^VM-^EM-bM-^VM-^DM-bM-^VM-^CM-bM-^VM-^BM-bM-^VM-^A  |$
|                                              |$
+----------------------------------------------+$

Then boxes still needs work.

cmake and windows builds

I noticed there's a cmake branch which is not up-to-date, it seems to work on my version of linux.

Use of (for example) unistd.h mean boxes wont compile in msvcc, but mingw should be fine.

Is the intention to replace the current gnu-make build system?

And if so, with a new CMake system, it would be good to integrate the current testing framework with CTest

Android support

Hi,

Where do I place boxes.cfg on the Android system? Can't it be in the same folder as the executable?

Thanks in advance.

Word/line wrap based on size variable

Would like to see it automatically word-wrap on long lines based on the -s setting.

Example:

1234567890

boxes -s 7

!!!!!!!
!12345!
!67890!
!!!!!!!

Help building boxes 2.0.0 with additional include and library paths

This isn't a bug report per se with boxes, but a request for help with building. Namely, I build boxes locally because I'm on a cluster where I don't have admin rights and I'll never convince the admins to zypper in boxes. So, I build myself.

Today I tried this and:

$ make
| For compilation info please refer to the boxes compilation FAQ
| at https://boxes.thomasjensen.com/docs/faq.html#q5
fatal: not a git repository (or any parent up to mount point /gpfsm)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
sed -e 's/--BVERSION--/2.0.0 ()/; s/--GLOBALCONF--/\/usr\/share\/boxes/' src/boxes.h.in > src/boxes.h
sed -e 's/--BVERSION--/2.0.0/; s/--GLOBALCONF--/\/usr\/share\/boxes/' doc/boxes.1.in > doc/boxes.1
make -C src BOXES_PLATFORM=unix build
make[1]: Entering directory '/gpfsm/dswdev/mathomp4/local-SLES12/src/boxes-2.0.0/src'
make BOXES_PLATFORM=unix ALL_OBJ="parser.o lex.yy.o boxes.o generate.o regulex.o remove.o shape.o tools.o unicode.o" CFLAGS_ADDTL="-O " STRIP=true flags_unix boxes
make[2]: Entering directory '/gpfsm/dswdev/mathomp4/local-SLES12/src/boxes-2.0.0/src'
make[2]: Nothing to be done for 'flags_unix'.
bison -o parser.c -d parser.y
gcc -I. -Wall -W -O    -c -o parser.o parser.c
In file included from parser.y:32:0:
boxes.h:33:22: fatal error: unitypes.h: No such file or directory
 #include <unitypes.h>
                      ^
compilation terminated.
<builtin>: recipe for target 'parser.o' failed
make[2]: *** [parser.o] Error 1
make[2]: Leaving directory '/gpfsm/dswdev/mathomp4/local-SLES12/src/boxes-2.0.0/src'
Makefile:43: recipe for target 'build' failed
make[1]: *** [build] Error 2
make[1]: Leaving directory '/gpfsm/dswdev/mathomp4/local-SLES12/src/boxes-2.0.0/src'
Makefile:38: recipe for target 'build' failed
make: *** [build] Error 2

Obviously, I need libunistring (at least). So I downloaded and built it locally, but now I'm wondering: How do I inform boxes of this? I tried staring at the Makefiles and tried:

$ make LDFLAGS_ADDTL='-I/discover/swdev/mathomp4/local-SLES12/include -L/discover/swdev/mathomp4/local-SLES12/lib'

but that didn't seem to help. Any ideas?

Help with updating boxes in Homebrew

This is for @tsjensen I guess. I'm trying to update the boxes version in Homebrew, and one of the things that tripped me up was:

brew audit --strict boxes
boxes:
  * Formula boxes contains deprecated SPDX licenses: ["GPL-2.0"].
    You may need to add `-only` or `-or-later` for GNU licenses (e.g. `GPL`, `LGPL`, `AGPL`, `GFDL`).
    For a list of valid licenses check: https://spdx.org/licenses/
Error: 1 problem in 1 formula detected

The reply was:

Usually, the source headers or the readme files indicate whether it's -only or -or-later. If it's still unclear, you can consult with the developer.

Do you know which is correct? I think it's -only, but I want to be sure!

Vim syntax file: DELIM statement not properly implemented in highlighting

To Reproduce:
Open issue64-config.txt in Vim and activate syntax highlighting via set syn=boxes. All shape lines in box design delimtest are marked as error:

vim-syntax-bug2

This problem only happens if the delim command sets string delimiters to something other than double quotes (here: pipes).

Expected behavior
Instead, we would expect all shape lines to appear as regular strings, without error markings. The delim command changes the delimiter character for the strings in this box design, which should be picked up by the highlighter.

Environment:

boxes.el history list nil

Hi

In Debian I got a report about the boxes.el (I'm not an emacs user myself), so I'm just forwarding it

From: Kevin Ryde <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: boxes: boxes.el history list nil
Date: Sun, 06 Dec 2015 16:33:09 +1100

Package: boxes
Version: 1.1.2-3
Severity: minor
Tags: patch
File: /usr/share/emacs/site-lisp/boxes.el

In boxes.el the boxes-history variable is set to (list nil) but nil is
not a string.  You can see the effect by trying to step back to it,

    M-x boxes-command-on-region
    M-p
    =>
    previous-history-element: Wrong type argument: char-or-string-p, nil

Usually an empty history variable is made just by

    (defvar boxes-history nil)

Original report is at: https://bugs.debian.org/807153

Regards,
Salvatore

Cisco Comment - Single line box not working correctly

Using latest Windows build on Notepad++:

Let’s say I have this in a text file

ipv4 access-list HOSTS
1 remark DC1 HOST
2 permit ipv4 host 192.168.1.1 any
3 remark DC2 HOST
4 permit ipv4 host 192.168.2.1 any
5 remark DC3 HOST
6 permit ipv4 host 192.168.3.1 any

Now, I want to “comment out” the remark and permit line for DC2 HOST. (Lines 3 and 4)

What I want to do is highlight those 2 rows, run box on it and get the following output

ipv4 access-list HOSTS
1 remark DC1 HOST
2 permit ipv4 host 192.168.12.90 any
! 3 remark DC2 HOST
! 4 permit ipv4 host 192.168.12.91 any
5 remark DC3 HOST
6 permit ipv4 host 192.168.16.90 any

However, seems like I am either missing something in my config, or box is behaving different than I expect… If I highlight those 2 lines and then run box on it I get this.

ipv4 access-list HOSTS
1 remark DC1 HOST
2 permit ipv4 host 192.168.12.90 any
! 3 remark DC2 HOST
! 4 permit ipv4 host 192.168.12.91 any
 
5 remark DC3 HOST
6 permit ipv4 host 192.168.16.90 any

What is causing the extra line?

Here is my box config for this

BOX cisco-comment
 
    sample
        ! text
    ends
 
    shapes {
       w("!")
    }
 
    elastic (w)
 
    padding {
                horizontal 1
    }
 
END cisco-comment

Here is the command that is executed in notepad++

NPP_CONSOLE 0  
cls
cmd.exe /c exit %RANDOM%
set tempfile = $(SYS.TEMP)\NppBoxes_$(EXITCODE).out.txt
set ascfile = $(SYS.TEMP)\NppBoxes_$(EXITCODE).in.txt
sel_saveto $(ascfile) :a
C:\boxes-1.2\boxes -d cisco-comment "$(ascfile)" "$(tempfile)"
sel_loadfrom $(tempfile)
cmd.exe /c del /f /q "$(tempfile)" "$(ascfile)"

Any help you can provide or explain what I am doing incorrectly would be greatly appreciated…

Allow alias names for designs

I would like to make your vim-integration more flexible. Instead of defining for every filetype an autocommand, I would prefer to sync design names and filetype names of vim, so there is an autocommand using the filetype option of vim.

Adding a second design name, e.g. to ada-box the alias ada and to shell the alias Makefile, makefile etc, would be necessary.

boxes.c: 9 * resource leak ?

[boxes.c:422]: (error) Resource leak: new_yyin
[boxes.c:426]: (error) Resource leak: new_yyin
[boxes.c:431]: (error) Resource leak: new_yyin
[boxes.c:451]: (error) Resource leak: new_yyin
[boxes.c:457]: (error) Resource leak: new_yyin
[boxes.c:511]: (error) Resource leak: new_yyin
[boxes.c:515]: (error) Resource leak: new_yyin
[boxes.c:521]: (error) Resource leak: new_yyin
[boxes.c:704]: (error) Resource leak: f

Change default "carriage return"

Hi,
I would like the default "carriage return", for use or CR or LF or both
I don't find any parameter to do that.

To avoid this (on windows).
PS: I use mainly sublime

immagine

immagine

OSX Bad Address

On Mac OSX 10.9 64bit, boxes delevopment version almost always crashes (except when called as boxes -v or boxes -h) with the error message: boxes: Bad address. If compiled with -DDEBUG and called as echo 1 | ./boxes, it crashes with

BOXES STARTING ...
Processing Command Line ...
Command line option settings (excerpt):
- Padding: l:-1 t:-1 r:-1 b:-1
- Requested box size: 0x0
- Tabstop distance: 8
- Tab handling: 'e'
- Alignment: horiz ?, vert ?
- Indentmode: '?'
- Line justification: '?'
- Kill blank lines: -1
- Remove box: 0
- Mend box: 0
- Design Definition W shape: n/a
Parsing Config File ...
boxes: Bad address

The output of make is

For compilation info see the boxes website at http://boxes.thomasjensen.com/
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src build
/Applications/Xcode.app/Contents/Developer/usr/bin/make CFLAGS_ADDTL=-O boxes
bison -o parser.c -d parser.y
gcc -ansi -I. -DDEBUG -Iregexp -Wall -W -O   -c -o parser.o parser.c
parser.y: In function ‘design_needed’:
parser.y:400:9: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration]
parser.y: In function ‘yyparse’:
parser.y:548:9: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
parser.y:548:36: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:591:42: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:598:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:605:43: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:612:43: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:679:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:857:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:859:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:888:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:890:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:1001:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:1024:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
parser.y:1045:13: warning: implicit declaration of function ‘strncasecmp’ [-Wimplicit-function-declaration]
flex -t lexer.l > lexer.tmp.c
echo '#include "config.h"' > lex.yy.c
cat lexer.tmp.c >> lex.yy.c
rm lexer.tmp.c
gcc -ansi -I. -DDEBUG -Iregexp -Wall -W -O   -c -o lex.yy.o lex.yy.c
lexer.l: In function ‘yylex’:
lexer.l:177:5: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
lexer.l:177:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
lexer.l:201:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
lexer.l:258:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
lexer.l:374:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
lexer.l:399:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
<stdout>: In function ‘yy_scan_bytes’:
<stdout>:2250:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
lexer.l: At top level:
<stdout>:1846:16: warning: ‘input’ defined but not used [-Wunused-function]
gcc -ansi -I. -DDEBUG -Iregexp -Wall -W -O   -c -o boxes.o boxes.c
boxes.c: In function ‘get_config_file’:
boxes.c:428:9: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
boxes.c:428:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
boxes.c:454:34: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
boxes.c:517:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
boxes.c: In function ‘process_commandline’:
boxes.c:583:9: warning: implicit declaration of function ‘getopt’ [-Wimplicit-function-declaration]
boxes.c:661:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
boxes.c:684:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
boxes.c:710:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
boxes.c:730:17: warning: implicit declaration of function ‘strncasecmp’ [-Wimplicit-function-declaration]
boxes.c: In function ‘style_sort’:
boxes.c:1113:5: warning: implicit declaration of function ‘strcasecmp’ [-Wimplicit-function-declaration]
boxes.c: In function ‘list_styles’:
boxes.c:1200:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
boxes.c:1200:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
boxes.c:1200:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
boxes.c:1200:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
boxes.c: In function ‘apply_substitutions’:
boxes.c:1452:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
boxes.c: In function ‘read_all_input’:
boxes.c:1558:53: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
gcc -ansi -I. -DDEBUG -Iregexp -Wall -W -O   -c -o tools.o tools.c
tools.c: In function ‘strisyes’:
tools.c:126:5: warning: implicit declaration of function ‘strncasecmp’ [-Wimplicit-function-declaration]
tools.c: In function ‘expand_tabs_into’:
tools.c:300:7: warning: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration]
tools.c:300:28: warning: incompatible implicit declaration of built-in function ‘calloc’ [enabled by default]
tools.c:321:4: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
tools.c:321:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
tools.c: In function ‘tabbify_indent’:
tools.c:425:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
tools.c:428:5: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
tools.c:428:23: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]
gcc -ansi -I. -DDEBUG -Iregexp -Wall -W -O   -c -o shape.o shape.c
gcc -ansi -I. -DDEBUG -Iregexp -Wall -W -O   -c -o generate.o generate.c
generate.c: In function ‘horiz_precalc’:
generate.c:146:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:146:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:146:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:146:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:146:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:146:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c: In function ‘horiz_generate’:
generate.c:573:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:573:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:573:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:573:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:577:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:577:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:577:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:577:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:577:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:577:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:579:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:579:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:579:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:579:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:583:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:583:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:583:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:583:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:583:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:583:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:604:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:604:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:609:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:609:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c: In function ‘vert_generate’:
generate.c:649:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:649:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:649:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:649:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:649:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:649:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:653:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:653:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:653:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:653:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:653:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:653:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:655:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:655:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:655:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:655:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:655:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:655:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:659:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:659:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:659:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:659:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:659:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:659:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:679:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:679:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:684:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:684:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c: In function ‘output_box’:
generate.c:922:9: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
generate.c:922:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘size_t’ [-Wformat]
generate.c:1005:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘size_t’ [-Wformat]
generate.c:1025:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:1025:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:1025:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:1025:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
generate.c:1025:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
generate.c:1025:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
generate.c:1025:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
generate.c:1025:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘size_t’ [-Wformat]
gcc -ansi -I. -DDEBUG -Iregexp -Wall -W -O   -c -o remove.o remove.c
remove.c: In function ‘best_match’:
remove.c:116:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:116:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:117:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:117:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:137:13: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
remove.c:137:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
remove.c:200:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:200:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
remove.c:200:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:200:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
remove.c:208:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
remove.c: In function ‘hmm’:
remove.c:289:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
remove.c:289:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
remove.c: In function ‘detect_horiz’:
remove.c:398:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:398:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:448:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat]
remove.c:448:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat]
remove.c:477:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat]
remove.c:477:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat]
remove.c: In function ‘remove_box’:
remove.c:866:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:866:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
remove.c:866:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:866:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat]
remove.c:868:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:868:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:869:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:869:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:885:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:885:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:886:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:886:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:899:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:899:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:911:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:911:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:912:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:912:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:924:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:924:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:933:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:933:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 9 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 11 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 13 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 6 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 9 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 11 has type ‘long int’ [-Wformat]
remove.c:946:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 13 has type ‘long int’ [-Wformat]
remove.c:976:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
remove.c:976:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t’ [-Wformat]
remove.c:1042:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c:1042:17: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ [-Wformat]
remove.c: In function ‘output_input’:
remove.c:1093:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C regexp CC=gcc libregexp.a
gcc -O -I. -O -c regexp.c
gcc -O -I. -O -c regsub.c
ar cr libregexp.a regexp.o regsub.o
gcc -Lregexp parser.o lex.yy.o boxes.o tools.o shape.o generate.o remove.o -o boxes -lregexp
strip boxes

Add Option for EOL Normalization/Control

Feature request: add EOL normalization control option:

--eol=[cr|lf|crlf]

Rationale: I've integrated boxes in Sublime Text, following the instructions on the website, but the CR EOL creeps into the text ouput as binary character <0x0d> (Git then sees the document as a binary file).

This is most likely an issue with the FilterPipes Sublime Text package not taking care of EOLs, but it nevertheless brings up the issue of piping/redirecting boxes output in different contexts.

IMO, being able to enforce a specific EOL (overriding the OS native EOL) would be useful on Windows, especially when working with Bash for Windows or bridging the ouput of various tools across WSL (Windows Subsystem for Linux), where different tools might enforce/expect different EOLs.

Although one could just pipe the output through dos2unix/unix2dos, an integrated option would be preferable. It would also allow Linux users to emit Windows style EOLs in automated toolchains (e.g. appending boxes output to a file marked as text eol=crlf in .gitattributes).

A small option that could ultimately spare lots of headaches, without affecting backward compatibility in any way.

Question: Open Box Sides and Elastic shapes

In the docs it says:

  • At least one shape per side must be elastic.

But if a box has and open side (lets say the right one), then why would the top and bottom side need be elastic at all? Couldn't it be a fixed design, wrapping the text above, left, below, without closing it on the left. So, there would be no real need for elastic sides, except on the right, which would have to stretch to accomodate the number of text lines.

The top and bottom could consist just of a N and S fixed designs. And right could just be an elastic W (eg: " || "). No corners needed either. It would be like a kind of "C" design, that clamps part of the text horizontally, and doesn't care if the text is longer than the top edge.

Is this allowed right now?

Vim syntax file: Setting `iskeyword` globally in vim script breaks other plugins

The boxes.vim has a global setting that effects many other filetype plugins:

" Set the keyword characters
set iskeyword=a-z,A-Z

The default value for this option: is @,48-57,_,192-255.

Most plugins add or remove specific characters in a buffer local fashion. Completely resetting the global value has unintended consequences, such as, '*' command no longer works as expected.

UTF-8 Support

Boxes currently works with ASCII characters only. Well, at least every character must consist of a single byte.
Multi-byte character support becomes increasingly important, so boxes should be upgraded to support UTF-8.
(submitted by David Karafiát on Sat, 28 Jun 2008, but since requested many times)

Sometimes an empty line is appended when processing a text selection with Notepad++

A demonstration follows below. At first, there is only one empty line after the selected text, but when I process the selection through "$(boxes_p)" -i box -t 4 -d c-cmt2 "$(ascfile)" "$(tempfile)", then a further empty line is added:

b23wiwn63t

The sample text I'm trying to enclose with Boxes:

	Basedsad
	as as dsa dsa readdirsad stackavail asd 
	as das das
	
			dfsdf
			sadfsdf
			sdfsdf
			
			   asdasd
			   asdasdff
			   f

  asd
    as fas 
	fas 
as

I'm using boxes version 1.2.

Remove Leading Whitespace When Removing Box

Is it possible to add an option when removing a box with $ boxes -r also to remove leading whitespace.

For example, I have typed BIBFILE on new line in my tex file and have changed it to a header with
:'<,'>!boxes -d tex-box -s 80
which becomes

%------------------------------------------------------------------------------%
%                                   BIBFILE                                    %
%------------------------------------------------------------------------------%

When removing the box with
:'<,'>!boxes -r
I get:

                                  BIBFILE

Could also the leading whitespace be removed to get a cyclic behaviour?

“Bad Address”

I’m currently building boxes on Mac OS 10.10, but had this issue on 10.9 (or perhaps 10.8?) as well. At some point in the past year, building boxes has resulted in a “Bad Address” error. I think it might be due to developer tools (GCC maybe?) updating to a new version that broke something, but my knowledge of this stuff ends with Python/Ruby. @tellerlecker brought up the error several months ago here.

The specific (and delightfully succinct) error: boxes: Bad address

That seems like an ultra generic error. If there’s anything I can do to provide more specific details, do let me know.

Allow to compile on 64-bit

The source code of boxes is actually 64-bit compatible, but it currently does not build in 64-bit on macOS. The reason: the -ansi flag is passed to the compiler, although non-ANSI (non-C89) functions are allowed (such as strings functions like strdup). Thus the -ansi flag should be removed.

Another unrelated issue is that src/parser.y uses strcasecmp without including the necessary strings.h system header.

The attached patch fixes both issues, and allows boxes to compile in 64-bit mode, which is the default on macOS (most computers nowadays are 64-bit, and many do not carry 32-bit compatibility anymore).


diff --git a/src/Makefile b/src/Makefile
index c2656df..db19d29 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -62,7 +62,7 @@ boxes.exe: $(ALL_OBJ)
 
 
 flags_unix:
-       $(eval CFLAGS := -ansi -I. -Iregexp -Wall -W $(CFLAGS_ADDTL))
+       $(eval CFLAGS := -I. -Iregexp -Wall -W $(CFLAGS_ADDTL))
        $(eval LDFLAGS := -Lregexp $(LDFLAGS_ADDTL))
        $(eval BOXES_EXECUTABLE_NAME := boxes)
        $(eval ALL_OBJ := $(GEN_SRC:.c=.o) $(ORIG_NORM:.c=.o))
diff --git a/src/parser.y b/src/parser.y
index c9acfbd..a32ef36 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include "shape.h"
 #include "boxes.h"
 #include "tools.h"

warning: implicit declaration of function 'strdup'

Hi

This is forwarding the bug reported in the Debian BTS at https://bugs.debian.org/793390

------8<-----------8<-----------8<-----------8<-----------8<-----

Package: boxes
Version: 1.1.2-2
User: [email protected]

The current version build log [1] includes this warning
"lexer.l:101:5: warning: implicit declaration of function 'strdup'
[-Wimplicit-function-declaration]"

That warning makes the build fail on Ubuntu
https://launchpadlibrarian.net/210104836/buildlog_ubuntu-wily-amd64.boxes_1.1.2-2_BUILDING.txt.gz

"Our automated build log filter detected the problem(s) above that will
likely cause your package to segfault on architectures where the size of
a pointer is greater than the size of an integer, such as ia64 and amd64."

[1]
https://buildd.debian.org/status/fetch.php?pkg=boxes&arch=amd64&ver=1.1.2-2&stamp=1430047837

------8<-----------8<-----------8<-----------8<-----------8<-----

Regards,
Salvatore

Add support for XDG Base Directory Specification

Boxes currently looks in $HOME for its user configuration file. This practice clutters $HOME with countless dotfiles and makes organization difficult. The XDG Base Directory Specification helps to solve this problem by putting a program-specific directory under (usually) $HOME/.config. I would love to see boxes support this.

I am currently running boxes version 1.2 on Ubuntu 18.04.4 LTS.

Better if the error prompt is more friendly

Before I carefully went through the manual, I attempted to set the width only by boxes -s 70x. Apparently it would fail, but with prompt:

boxes: box size: Interrupted system call, '70x'

I believe it might be better to show a more friendly prompt when there's parsing error with option string, with something like "boxes: box size: illegal option string", for example. Thanks!

boxes version: 1.2.

Mending a box changes its overall indentation if the text inside the box is centered

Mending a box changes its overall indentation if the text inside the box is centered. (Reported by boxes user rubikitch on 2007-10-12)
Boxes cannot tell from the input text if the text inside the box was already indented from the start or if what appears to be indentation is caused by the text having been centered. So, in order to resolve this, boxes would have to rely on command line arguments passed when mending (like -a c).

Example:

$ echo foo | boxes  -a c -s 10 -d shell
##########
#  foo   #
##########
$ echo foo | boxes  -a c -s 10 -d shell | boxes -a c -s 10 -m
 ##########
 #  foo   #
 ##########
$ echo foo | boxes  -a c -s 10 -d shell | boxes -a c -s 10 -m | boxes -a c -s 10 -m
  ##########
  #  foo   #
  ##########
$ echo foo | boxes -s 10 -d shell
##########
# foo    #
##########
$ echo foo | boxes  -s 10 -d shell | boxes  -s 10 -m
##########
# foo    #
##########

How to select "default" box?

I'm wondering if there is a way to select the default box generated when you just run boxes? I know the C box is the one that "wins" per the webpage, but I mainly do Fortran programming, so I'd like that to be the default.

Is there a "tag" maybe I can add to boxes-config? Say tag default?

Enable tagging of box designs in config file

I've noticed in the docs tutorial that you presented the "keyword" tag—which right now might not be implemented.
In my box contribution I've used it (but in plural: "keywords"), because I think that it's going to be rather useful as soon as the designs list is going to grow: keywords might help filter between categories to display with -L switch.
I'd say that more than one keywords could be used, comma-separated. Also aliasing "-keyword" with "-keywords" and "-k" (singular, plural, shorthand) would be a good idea.
I really like boxes, it reminds me of a PhotoShop plugin I had: Alien's "Splat!Frame", which allowed to build custom frames with a very similar system of 16 regions (but in a TIFF image). Well done!

Indentation isn't maintained when processing a text selection with Notepad++

I'm not able to maintain the original text indentation when processing the selection through Boxes with Notepad++.

A demonstration follows below. At first, the selected text is indented with tabs, but when I process the selection through "$(boxes_p)" -i box -t 4 -d c-cmt2 "$(ascfile)" "$(tempfile)", then the tab indentation gets lost (you can notice that by looking at the cursor's movements):

iwbrt29eyd

The sample text I'm trying to enclose with Boxes:

	Basedsad
	as as dsa dsa readdirsad stackavail asd 
	as das das
	
			dfsdf
			sadfsdf
			sdfsdf
			
			   asdasd
			   asdasdff
			   f

  asd
    as fas 
	fas 
as

I'm using boxes version 1.2.

Support For ANSI/VT100 Control Sequences

I'm using boxes 1.3 on a linux box.

It would be wonderful to have full support for "colors" such as:

echo -e '\e[41mHELLO\e[49m\n\e[41mWORLD\e[49m' | ./boxes -f boxes-config -d shell -s 50 -a hcvc

Currently the colors are reproduced correctly but the boxes are drawn incorrectly due to the presence of the escape sequences:

##################################################
#                HELLO                 #
#                WORLD                 #
##################################################

Since I truly love to have colored text, is anybody willing to tell me where in the source code I should take a look to come up with a quick and dirty fix for this specific case (2 escape sequences of the same length per line, on all lines)?

Implementing "designer" keyword

Hi Thomas, great work! As I pointed out in my pull request, I stepped into an "ethical" problem: I implemented a nice ASCII-Art frame that I've found on the net, one of those that have been goin around for ages. As is often the case for many of these artworks, they have a little signature somewere in the design.
I wasn't able to trace the author (just akn), so I've added "akn" it in the boxe sample, specifying that I am just the implementor. I was in doubt as if to put myself as the author or not. I am the implementor, or the author?
I think that boxes project could take a stand on this: I foresee the issue coming up often. It's not nice to just wipe away credits from an author, even if it boils down to 3 letters—but that was exactly how the BBS world was run: nicknames, pseudonyms, ecc.
I've removed the "akn" letters from the box design (they appeared in the lower part), but I did so mainly to save myself the great hassle of having to add another region to the frame. But I made a point of mentioning it in the sample I've created.
Maybe the issue is worth mentioning in the docs, and also you could be implement a tag for "implementor" (or "original designer") to distinguish between the two.
As it is, it is not clear (at least to me) if author means the author of the filter, or its designer.
Designer and implementor are more specific. Surely, I have tons of nice ASCII-Art frames and snippets that I could "port" to boxes. Like for cowsay and FIGLet, obviously there is going to be a lot of people fetching old designs from BBS archives and websites, and implement them in boxes. That's how "nostalgics" preserve oldschool and revive it, right? From emulators of old home computers, to ANSI and ASCII Art, MUDs, ecc., there are always waves of revival, but often authorship is lost along the way — still, credit is due where its due!!

Error in test case: 114_headline_ansi_unicode_remove.txt

Hello. There very minor issue in new version during tests. In v2.0.0 all tests passed except this one:

Error in test case: 114_headline_ansi_unicode_remove.txt (top: actual; bottom: expected)

To Reproduce

  1. Compile boxes from sources.
  2. Run make test.

Expected behavior
All tests passed.

Environment (please complete the following information):

  • Boxes v.2.0.0
  • Fedora 33

boxes RPM doesn't exist for Fedora EPEL 7

Hey, first of all thank you for your boxes project. I use it all the time with CentOS 6 via EPEL.

I recently started using CentOS 7, but EPEL 7 does not have a boxes package available yet. See this link.

I'm not a developer/EPEL expert, just a lowly sysadmin type of person, but is there anything I can do to help?

Let me know if this is the wrong place to bring it up and I'll take the issue elsewhere.

incorrect Chinese alignment

If the input has Chinese words, the alignment is not right. Looks like this:
//
/
This is a test string. 这是一个测试段落 /
/
/

"Toggle" function when commenting code with Notepad++

In Notepad++, when you want to toggle some code comments you can press Ctrl + Q.

Pressing that combination adds comments if absent, else removes them:

rglaktsgc8

Do you think that something like that could be doable with Boxes? I mean, an option so that:

  • If the selection has been previously commented, then Boxes removes the comments.
  • If the selection is not commented, then Boxes add the comments.

This could also apply to the other Boxes block templates as well (i.e., not related to code comments).

So, something like this:

  • If Boxes has not been applied to the selection, then enclose the text with Boxes:
    boxes -d <BOX_DESIGN> "$(ascfile)" "$(tempfile)"
  • If the selection has been processed with Boxes, then remove text added by Boxes:
    boxes -r -d <BOX_DESIGN> "$(ascfile)" "$(tempfile)"

Thus, the resulting command could be something like the following:

boxes -toggle -d <BOX_DESIGN> "$(ascfile)" "$(tempfile)"

where toggle could represent the newly added option.

Ability to integrate input text into the box frame

Ability to integrate input text into the box frame (submitted by Tobias Buchal on Thu, 13 Jan 2000)

Orginal Text:

    file:line
    test text text
    test text text

Desired Output:

    |---(file:line)------     <-- this line must currently be done manually
    |test text text
    |test text text
    |--------------------

While this feature is not implemented, the effect must be achieved by using editor mappings.

The GNU C Library no longer implements <regexp.h>

If we set default, proper Fedora build flags Boxes won't compile.

To Reproduce

Try set %set_build_flags and:

%make_build                     \
    GLOBALCONF=%{cfgfile}       \
    CFLAGS='%{optflags}'        \
    LDFLAGS='%{build_ldflags}'  \

Result is:

In file included from boxes.h:33,
                 from boxes.c:31:
/usr/include/regexp.h:30:2: error: #error "The GNU C Library no longer implements <regexp.h>."
   30 | #error "The GNU C Library no longer implements <regexp.h>."
      |  ^~~~~
/usr/include/regexp.h:31:2: error: #error "Please update your code to use <regex.h> instead (no trailing 'p')."
   31 | #error "Please update your code to use <regex.h> instead (no trailing 'p')."
      |  ^~~~~
In file included from boxes.c:31:
boxes.h:84:5: error: unknown type name 'regexp'
   84 |     regexp *prog;                        /* compiled search pattern */
      |     ^~~~~~
boxes.c: In function 'apply_substitutions':
boxes.c:1266:25: warning: implicit declaration of function 'regcomp' [-Wimplicit-function-declaration]
 1266 |         rules[j].prog = regcomp (rules[j].search);
      |                         ^~~~~~~
boxes.c:1266:23: warning: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
 1266 |         rules[j].prog = regcomp (rules[j].search);
      |                       ^
boxes.c:1284:23: warning: implicit declaration of function 'myregsub' [-Wimplicit-function-declaration]
 1284 |             buf_len = myregsub (rules[j].prog, input.lines[k].text,
      |                       ^~~~~~~~

Expected behavior

Boxes successfully compiles with proper build flags and useful debuginfo.

Environment (please complete the following information):

  • Boxes version v1.3
  • Your operating system and architecture, e.g. Fedora 31

Additional info

full_build.log

Integration with sublime

Hi,
I'm looking for integrate boxes with sublime text. I haven't find a package or guide line for do that.
How can I do?

boxes-1.2 variable settings in Win10

When trying to run boxes from prompt/cmd that returns an error:
boxes: Couldn't open config file 'C:\Program Files\boxes-1.2' for input (taken from $BOXES).
but boxes.cfg is inside the mentioned directory as above.

I've already pre-set the path variable as well, like:
setx /M path "%path%;C:\Program Files\boxes-1.2"

Any suggestion, please.
regards,
Raphael

Outfile not recognized when -r is specified (box removal)

This is what I actually do into Notepad++ to generate a box around a text selection, according to the docs:

boxes.exe -d stone -s 80 -ac "$(ascfile)" "$(tempfile)"

By doing so, it works.

But, if I want to remove the box through:

boxes.exe -r -d stone "$(ascfile)" "$(tempfile)"

then the resulting output is sent to the stdout (shown in NppExec console), and not to the $(tempfile) file, thus the originally selected text is replaced with an empty string.

I'm using boxes version 1.2.

Spec file for building RPMs

I have been trying to use the boxes.spec file to build an RPM. First, I had to do some adjustments (change copyright to license, and properly escape the % in the find command by doubling it). This is the command that I tried after building boxes:

rpmbuild -ba boxes.spec --build-in-place

This is as far as I could get. Now I get the following error:

Bad file: /home/d2/rpmbuild/SOURCES/v2.0.0.tar.gz: No such file or directory

I'm not too familiar with the RPM building process, so I don't know if the spec file needs further adjustments, or if it is just an invocation problem on my end.

Problems with boxes.el in xemacs

Hi!

I got another bugreport for boxes in Debian, reported as https://bugs.debian.org/807439 . I'm no (x)emacs user myself, so would appreciate if you can look at it as well and confirm if this is the right overall fix to apply (if so attached to the Debian bug is a patch)

From: Kevin Ryde <[email protected]>
To: [email protected]
Subject: boxes: boxes.el in xemacs
Date: Wed, 09 Dec 2015 08:35:12 +1100

Package: boxes
Version: 1.1.2-3
Severity: normal
Tags: patch
File: /usr/share/emacs/site-lisp/boxes.el

boxes.el doesn't work in xemacs21 (which is still in debian) due to a
6-arg call to shell-command-on-region.

    M-x boxes-create
    => Wrong number of arguments: shell-command-on-region, 6

I suggest omitting this arg since its `nil' there is the default anyway
in gnu emacs.

[boxes.el.shell-command.diff (text/x-diff, inline)]
--- boxes.el.orig   2015-01-17 08:16:13.000000000 +1100
+++ boxes.el    2015-12-09 08:27:01.988263968 +1100
@@ -117,7 +117,7 @@
             (concat boxes-args " -r "))
         (if type
             (concat boxes-args " -d " type)))))
-    (shell-command-on-region start end command-string nil 1 nil)))
+    (shell-command-on-region start end command-string nil 1)))

 (provide 'boxes)
 ;;; boxes.el ends here

Regards,
Salvatore

Compilation on Arch Linux

Hello,

I have problem compiling boxes on Arch Linux. Error message is:

| For compilation info please refer to the boxes compilation FAQ
| at http://boxes.thomasjensen.com/docs/faq.html#q5
sed -e 's/--BVERSION--/1.1.3-SNAPSHOT/; s/--GLOBALCONF--/\/usr\/share\/boxes/' src/boxes.h.in > src/boxes.h
sed -e 's/--BVERSION--/1.1.3-SNAPSHOT/; s/--GLOBALCONF--/\/usr\/share\/boxes/' doc/boxes.1.in > doc/boxes.1
make -C src BOXES_PLATFORM=unix build
make[1]: Entering directory '/home/jirka/tmp/boxes/boxes/src'
make BOXES_PLATFORM=unix ALL_OBJ="parser.o lex.yy.o boxes.o tools.o shape.o generate.o remove.o" CFLAGS_ADDTL="-O " STRIP=true flags_unix boxes
make[2]: Entering directory '/home/jirka/tmp/boxes/boxes/src'
make[2]: Nothing to be done for 'flags_unix'.
bison -o parser.c -d parser.y
gcc -ansi -I. -Iregexp -Wall -W -O    -c -o parser.o parser.c
flex -t lexer.l > lexer.tmp.c
echo '#include "config.h"' > lex.yy.c
cat lexer.tmp.c >> lex.yy.c
rm lexer.tmp.c
gcc -ansi -I. -Iregexp -Wall -W -O    -c -o lex.yy.o lex.yy.c
<stdout>: In function 'yy_get_next_buffer':
<stdout>:1705:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
<stdout>: In function 'yyensure_buffer_stack':
<stdout>:2102:21: error: C++ style comments are not allowed in ISO C90
<stdout>:2102:21: error: (this will be reported only once per input file)
lexer.l: At top level:
<stdout>:1800:16: warning: 'input' defined but not used [-Wunused-function]
<builtin>: recipe for target 'lex.yy.o' failed
make[2]: *** [lex.yy.o] Error 1
make[2]: Leaving directory '/home/jirka/tmp/boxes/boxes/src'
Makefile:49: recipe for target 'build' failed
make[1]: *** [build] Error 2
make[1]: Leaving directory '/home/jirka/tmp/boxes/boxes/src'
Makefile:37: recipe for target 'build' failed
make: *** [build] Error 2

I'm not C expert but I think that problem may be caused by compiling with -ansi flag which is probably set in file src/Makefile in target flags_unix. Or I have something wrong with my system. I am using GCC 5.3.0. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.