From 1d1b7854e2397b4aef915d5a15c2796d89349a9b Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 22 Dec 2024 16:35:05 +0100 Subject: Misc character display fixes * fix luwrap comparison function * strip high unicode controls in term/pager * use wcwidth in dirlist2html * remove combining category from strwidth * remove unused "disallowed" field from lineedit My initial goal with switching to wcwidth in dirlist2html was just to get rid of the outdated combining map in charwidth_gen. Then I realized that layout will normalize those out anyway, so we don't actually have to deal with them anywhere. Also, I found a few bugs in the process; high unicode control chars not being stripped out was a particularly bad one, as it allows for pages to mess up the terminal output. (Easiest way to replicate: just open a random binary file without this patch.) --- Makefile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 51d41295..d4d2d03b 100644 --- a/Makefile +++ b/Makefile @@ -90,19 +90,17 @@ $(OUTDIR_BIN)/mancha: adapter/tools/mancha.nim unicode_version = 16.0.0 .PHONY: unicode_gen -unicode_gen: $(OBJDIR)/genidna $(OBJDIR)/gencharwidth res/map/EastAsianWidth.txt - @printf 'Download EastAsianWidth.txt and IdnaMappingTable.txt from www.unicode.org? (y/n)' +unicode_gen: $(OBJDIR)/genidna $(OBJDIR)/gencharwidth + @printf 'Download EastAsianWidth.txt and IdnaMappingTable.txt from www.unicode.org? (y/n) ' @read res; if test "$$res" = "y"; then \ - cha -d 'https://www.unicode.org/Public/idna/$(unicode_version)/IdnaMappingTable.txt' >$@; \ - cha -d 'https://www.unicode.org/Public/$(unicode_version)/ucd/EastAsianWidth.txt' >$@; \ - else exit 1; fi + cha -d 'https://www.unicode.org/Public/idna/$(unicode_version)/IdnaMappingTable.txt' >res/map/IdnaMappingTable.txt; \ + cha -d 'https://www.unicode.org/Public/$(unicode_version)/ucd/EastAsianWidth.txt' >res/map/EastAsianWidth.txt; \ + fi $(NIMC) --nimcache:"$(OBJDIR)/idna_gen_cache" -d:danger -o:"$(OBJDIR)/genidna" res/genidna.nim $(NIMC) --nimcache:"$(OBJDIR)/charwidth_gen_cache" -d:danger -o:"$(OBJDIR)/gencharwidth" res/gencharwidth.nim $(OBJDIR)/genidna > res/map/idna_gen.nim $(OBJDIR)/gencharwidth > res/map/charwidth_gen.nim -src/utils/strwidth.nim: res/map/charwidth_gen.nim src/utils/proptable.nim - twtstr = src/utils/twtstr.nim src/utils/map.nim src/types/opt.nim dynstream = src/io/dynstream.nim src/io/dynstream_aux.c lcgi = $(dynstream) $(twtstr) $(sandbox) adapter/protocol/lcgi.nim @@ -130,7 +128,7 @@ $(OUTDIR_LIBEXEC)/nc: $(lcgi) $(OUTDIR_LIBEXEC)/gopher2html: $(twtstr) $(OUTDIR_LIBEXEC)/ansi2html: src/types/color.nim src/io/poll.nim $(twtstr) $(dynstream) $(OUTDIR_LIBEXEC)/md2html: $(twtstr) -$(OUTDIR_LIBEXEC)/dirlist2html: $(twtstr) src/utils/strwidth.nim +$(OUTDIR_LIBEXEC)/dirlist2html: $(twtstr) $(OUTDIR_CGI_BIN)/%: adapter/protocol/%.nim @mkdir -p "$(OUTDIR_CGI_BIN)" -- cgit 1.4.1-2-gfad0