--- a/joe/TODO
+++ b/joe/TODO
@@ -1,12 +1,139 @@
-
-Improvements:
-
- Long bash lines not quite working correctly...
+help screen with 8-bit character set chart does not show properly
+ - show it on 8-bit locales?
+
+only "brpaste" shows up in a macro when I paste: I rather have the text..
+
+old joe is messing up state file of new joe
+
+Add unicode normalization option to search
+
+Regex in ftyperc is weird because character set of file is not yet know. 
+For now we assume ascii_map..
+
+ftyperc improvements:
+  Can we highlight backup files? files ending in .in?
+
+Allow user to provide a regex for error parsing
+
+Make joerc file so we load system and local customizations
+- rc file format needs revamping:  You can not put comments on lines with string
+  arguments.
+
+long paths not working with cd command in shell windows?
+
+1218708  ? for unknown characters is not informative (at least highlight the ?)
+Show as hex <34>?
+   For byte coded unused character: display character as we do in C. [we do
+this already]
+
+1304794  X at end of line is changed to space when character above 128 in utf-8
+  - check this one
+
+check all type-like functions- make sure they expect unicode!
+hmm.. we always convert to unicode on input, but do we convert to the 8-bit
+charset of the buffer? check this.
+
+We could try go beyond tab and space.. but it's not so important...
+   - Need to parse utf8 in options.c and rc.c..
+   - Need to find all other places where we hand check for space and TAB
+   - Right now we can use brc on joe_isblank because the characters are all
+     one byte
+
+ parse_string not utf8? Should be OK: it's only used with emit_string.
+
+fixed buffer size is not good for some parse_ functions.. for example it
+limits the size of keyboard macros.  umtext is not good.. uses fixed buffer
+during print
+
+path.c: rmatch.. should depend on locale (character class)
+
+look at texec..
+
+- hex edit mode
+    - force switch to overtype mode?
+   hex is screwed up.  utf-8 file encoding needs to be off for hex mode.
+   also crlf mode.
+ - Review this: other things should be disabled also
+
+
+valgrind run: look for leaks.
+
+Prebuilt radix trees for character classes to avoid startup overhead?  We
+could do this..
+
+Digit values
+[wrote function, but not using it]
+
+Added some more convenient classes:
+   see http://www.w3.org/TR/xml11/#NT-NameStartChar
+   see http://www.w3.org/TR/xmlschma11-2/#regexs
+
+	\d	Digit: same as \p{Nd}
+	\D	opposite
+	\s	space, tab, newline, return
+	\S	opposite
+	\w	word character: [\x{0}-\x{10ffff}]-[\p{P}\p{Z}\p{C}]
+	\W	opposite
+	\p{block-name}
+
+	\i	NameStartChar
+			: A-Z _ a-z C0-D6 D8-F6 F8-2FF 370-37D 37F-1FFF 200C-200D 2070-218F 2C00-2FEF 3001-D7FF F900-FDCF FDF0-FFFD 10000-EFFFF
+	\I	opposite
+	\c	NameChar
+			\i - . 0-9 B7 0300-036F 203F-2040
+	\C	opposite
+
+
+Java:
+  isJavaIdentifierStart: \p{Nl} \p{L} \p{Pc} \p{Sc}
+  isJavaIdentifierPart: isJavaIdentifierStart \p{Mn} \p{Mc} \p{Nd} ignorable
+  ignorable: 0x00-0x08, 0x0e-0x1b, 0x7f-0x9F
+
+
+cursor position history probably not working
+when buffers switch in windows.
+
+Scratch always pushes.  Do we want this?  It's weird for ESC c.  Maybe have
+a no-push version of scratch.
+
+jmacs vs. mg vs gnu-emacs:
+
+	c-x b  jmacs: nbuf, gnu: offers prompt with next buffer [fixed, before in jmacs this was bufed]
+	c-x c-b	jmacs: bufed prompt.  gnu: menu. [fixed, before in jmacs this was nbuf]
+	c-x 0  (delete window) prints exit message even when we are not abandoning the file - why? [fixed]
+	M-^: jmacs: deletes indentation, blank lines below.  gnu: deletes indentation, blank line above- pulls current line to end of previous [fixed]
+
+	c-x c-s	jmacs: saves file.  gnu: prompts before saving.
+	c-x c-v jmacs: reload original.  gnu: prompts with original as default.
+	c-x d: jmacs: nothing.  gnu: menu.
+	c-x c-r: jmacs: nothing.  gnu: load file in read-only mode.
+
+	esc m  back to indentation (math in joe	Non-standard:
+
+	c-x g  is goto line in mg, is goto matching delimiter in jmacs, udf gnu
+	c-x p  previous window in mg  (prev error in jmacs), udf gnu
+	c-x n  other window in mg   (next error in jmacs), udf gnu
+	esc s search forwards   (suspend in jmacs, submenus in gnu)
+	esc r  search backwards  (move to center line in jmacs and gnu)
+
+Timing fix for bracketed paste should disable spaces.  We should have a mode
+to disable the timing fix.
+
+cd command: if you leave out the trailing / it ignores it
+cd command: should canonicalized version of path be stored in history?
+
+in ^KE: any nicer way to clear the current path other than Ctrl-Y?
 
  Should ^K E pop the shell window?
     if current is scratch it should pop
     popedit will not be needed then..
 
+- better grep-find (trigger in ^KE)
+
+
+vt Improvements:
+
+ Long bash lines not quite working correctly...
 
  'parse' can't be used with commands with pipe symbol
 
@@ -50,85 +177,10 @@
 Hex mode probably doesn't mix correctly with vt
 
 - - - -
- parsed file names with spaces not working correctly
- parse file names with no line numbers?
- [fixed]
-
- add shell commands to other rc files
- [done]
-
- status command should use status line escape sequences
- [done]
-
- messages from shell windows sometimes do not show up.  The issue is that
-when we close a prompt window, we resize the shell window.  This causes bash
-to redraw the line.  This input counts as typing and causes the message to
-be erased (it just causes a screen update which notices the updtab flag
-set).. We need some other way (than setting updtab) to clear the message-
-maybe set updtab on next user input.
- [fixed- now we remove message only on user input, not shell input]
-
- security hole with "math"
- [fixed]
-
- parserr - it would be nice if parsing was limited to a block
- [done]
-
- parserr - no way to turn off highlighting line (but ESC space is OK).
- [fixed: added release command]
-
- 'parserr' leaving many copies of buffer?
- [fixed]
-
- message printed when we close last window and switch to orphan buffer
- [fixed- now we always do it, but can turn off with noexmsg]
-
- shell joe command doesn't work with absolute path if prefix is added.
- this doesn't work well with ^KE either (need to clear path manually)
-   emacs does some magic here.. if it detects // it ignores prefix
-     two parts:
-       it displays prefix with { }
-       when opening file, it starts with the /
- [fixed- now we do same as emacs]
-
- when we 'edit' in a shell window, it should pop before loading the new one.
-  otherwise we get a bunch of copies of the shell window I think
- [fixed]
-
- Esc sequences could be optimized out: delete one if it results in same
- attributes that already exist
- [done]
-
- check for n^2 algorithms
- [done]
-
-Pgetc() does not now always return a character... this breaks paragraph
-formatter and anything that expect binsc(pgetc) to work.
- [fixed: we assign a code for each ansi sequence]
-
- clean up macro execute for magic shell commands:
-   only execute shell_ ones...
-   only execute if window is on screen...
-   how do we allow "file"?  it should only be allowed in prompts, and not
-   allowed to be typed into the shell.
- [done]
-
- Need per-shell window current directory.
-  Logbuf?  Sometimes?
- [done: the buffer records the current directory]
-
- color on status line gets messed up when shell text is colored.. how can
-this even happen?
- [fixed] 
-
- cursor in wrong position when I abort a window and shell window gets pulled
-on.. need EFIXXCOL, but joe crashes when I enable it for abort command.
- abort a window and shell window replaces it:
-   cursor is wrong. we need EFFIXCOL on abort.. any others?
-  [fixed]
-
- 'joe' in a shell window should edit a file.
-[done]
+maybe grep and build need to clear the block?
+   they don't because they clear markb/markk in process of clearing scratch
+   buffer
+
 
 [done: buffer stack]
  Not sure about switching to orphan mode.. but how can we have F1.F4 without it?
@@ -163,18 +215,6 @@
 Note: termcap emulation functions are gone from curses..
 	No, ncurses-devel was missing on ubuntu..
 
-Think more about keeping cursor in sync: from shell window, edit file, ^C,
-we're back in shell window but cursor is in the wrong place.
- [fixed- we were not keeping cursor up to date in orphan windows]
-
-nbuf/pbuf do not call resize, so swapping in a shell window is not properly resized.
- [seems to be fixed, but not sure where resize is getting called..]
-
-multiple windows open on one shell window is kind of broken (you get
-conflicting resize events from each of them).  There should be a concept
-of the master window.
- [fixed, we use the last one]
-
 Even then, a window should only be a master if the cursor matches the vt
 cursor.  This helps with the problem of closing a window and switching to
 another where cursor is far away.
@@ -182,17 +222,6 @@
   - using vtmaster to pick one to be the master...
      - how to switch it (for example if a window is closed)? maybe overall screen refresh has to watch for this?
 
-Need raw mode which works the old way.. (mostly for debugging joe..)
-  [done]
-
-Resize needs more testing.  Resize with 'man ls' not quite working.
-Weird things will happen with multiple window with synchronized cursors.
-   [fixed- was due to scrolling region not being resized]
-
-Resize not working when you kill other window?
- [seems to be ok]
-
-^K V should jump to vt cursor... (done)
 - - - -
 
 For JOE-3.6
@@ -216,13 +245,8 @@
 
 	a common operation is clearing a shell buffer: make a key for this?
 
-	document ` in 'txt' (format test as status line)
-	additional formatting things in status line
-		`%n		filename
-		`%dd		day
-		`%dm		month
-		`%dY		year
-		`%Ename%	environment variable
+
+
 
 Immediate:
 
@@ -250,29 +274,9 @@
 
 =-=-=-=-=
 
-should force -Wall if compiler is gcc
-
-=-=-=-=-=
-
-- rc file format needs revamping:  You can not put comments on lines with string
-  arguments.
-
-=-=-=-=-=
-
 option for compile window size (or make mfit prompt for the size)
 
 multi-file search & replace: check for deleted 'B *'.
-
-
-=-=-=-=-=
-
-- We need regexp for error parsing.
-
-=-=-=-=-=
-
-- better grep-find (trigger in ^KE)
-
-- need current directory for grep-find.
 
 Compiling:
 ----------
@@ -298,15 +302,7 @@
 
 allow options after string and istring? -just note it for now.
 
-Makefile.in and Makefile.am need to be the same as Makefile.
-
-622978   use last column
-
-1218708  ? for unknown characters is not informative (at least highlight the ?)
-
 1218701  report character offset in ^K-<space> (not just byte offset).
-
-1304794  X at end of line is changed to space when character above 128 in utf-8
 
 1323285  joe does not repeatedly wrap searches (add an option for this?)
 
@@ -370,11 +366,6 @@
   right-click is cancel?
   double-click is yes?
 
-- i18n issues:
-
-   hex is screwed up.  utf-8 file encoding needs to be off for hex mode.
-   also crlf mode.
-
 - - - -
 
 Dangerous situations:
@@ -395,15 +386,6 @@
 - - - - - - - -
 
 - name keyboard macro and append it to .joerc file
-
-- - - - - - - -
-
-- update man page
-
-- - - - - - - -
-
-- hex edit mode
-    - force switch to overtype mode?
 
 - - - - - - - -
 
@@ -426,10 +408,6 @@
 
 - - - - - - - -
 
-- better editing in shell windows: use for calculator mode too?
-
-- - - - - - - -
-
 - highlight all words which match during search?
 
 - - - - - - - -
@@ -439,20 +417,6 @@
 
 - - - - - - - -
 
-Make joerc file so we load system and local customizations.
-
-- - - - - - - -
-
-can we highlight backup files? files ending in .in?
-
-- - - - - - - -
-
-  define characters which make up words
-    There are some A-Zs in tomatch (should use i18n).
-
-- - - - - - - -
-
-- - - - - - - -
   exemac for first change: it should be run with cursor in window.
 
   -orphan will break -mnew, -mold macros (because macros are run without a
@@ -473,19 +437,15 @@
 
 Others:
 
+
 - completion list of internal commands brings up documentation
 
 - rectangular blocks: make this a local file option?
-
-- shell window intercept should be smarter.  hit ^K ^H- the ^H is going to the
-  shell window.
 
 - do not use ^[^[ for anything.  it prevents Alt-arrow
   from being useful.  It's usually bound to options, so at least
   make options pass unknown characters back to keysequence parser.
 
-- save all files without asking thing for quick compile
-
 options are screwed up: we copy window to buffer (to get buffer options
 to the buffer).  But if we have multiple windows, buffer options will have
 stale data.
@@ -493,12 +453,8 @@
 we are missing many query and prompt window abort handlers, which cause
 small memory leaks.
 
-regex: character classes? a-z matches any letter?
-
 can't load terminfo- should switch to termcap or provide compiled
 ANSI terminfo built in.
-
-Perl compatible regex search.
 
 Improvements for programming
 ----------------------------
@@ -544,10 +500,6 @@
 	    the fill prefix).
    
 
-Shell windows:
-
- Better environment settings for shell windows.
-
 Documentation:
 
  Include documentation for joe hackers.  I wrote a lot of this
@@ -562,8 +514,6 @@
 byte to byte conversions?
 UTF-8 decoder right at input instead of in qw and utype?
 
-UTF-8 syntax files?
-
 - right-left mode for Hebrew/Arabic?
 
   There is no good way to do this.  For all rtol, you could use a reversed
@@ -585,7 +535,6 @@
 
  Emit ESC c to reset terminal on startup?
 
- Look into clearing right-most column.
 
 Major new display modes:
 
@@ -600,12 +549,6 @@
 Major new features:
 
  Folding
-
-
-Options
-
- Fix it so all options appear in ^T.  Maybe make hook function
- to handle major changes.
 
 Other requests:
 
@@ -1010,3 +953,290 @@
 - F3	find next
 - F5	date/time
 
+===============================================
+Done:
+
+ Fix it so all options appear in ^T.  Maybe make hook function
+ to handle major changes.
+[done, we can assign mactos to ^T]
+
+ Look into clearing right-most column.
+[done, we now use it]
+
+Shell windows:
+ Better environment settings for shell windows.
+[done- we now have vt mode]
+
+Perl compatible regex search.
+[done!]
+
+regex: character classes? a-z matches any letter?
+[done!]
+
+- save all files without asking thing for quick compile
+[done! Use ESC c to save all]
+
+- shell window intercept should be smarter.  hit ^K ^H- the ^H is going to the
+  shell window.
+[done, we now have a context for this]
+
+  define characters which make up words
+    There are some A-Zs in tomatch (should use i18n).
+[done: fixed with i18n project]
+
+- better editing in shell windows: use for calculator mode too?
+[done, we have vt mode]
+
+- update man page
+[done, but keep it up to date]
+
+622978   use last column
+[done]
+
+- need current directory for grep-find.
+[done]
+
+should force -Wall if compiler is gcc
+[there is no way to do this]
+
+	document ` in 'txt' (format test as status line)
+	additional formatting things in status line
+		`%n		filename
+		`%dd		day
+		`%dm		month
+		`%dY		year
+		`%Ename%	environment variable
+[done]
+
+UTF-8 between 0x40000000 - 0x7FFFFFFF is not displayed correctly because of
+ANSI_BIT.  joe_wcwidth return 0 width for these, but it should be zero width
+only in ansi mode.
+ [done: we just changed ANSI_BIT to 0x80000000]
+
+Unicode:
+  Support combining characters properly.  
+[done]
+
+Can we find an updated version of wcwidth?
+[done- but do more checking]
+
+Rtree gets very big before calling rtree_opt.. (we were exceeding 32K leaf
+nodes, overflowing short)
+  We need to optimize while we build...
+  [done]
+
+Get rid of cmap, use rtree instead in kbd.c/kbd.h.  [cmap may have been
+better for this, but it does help debug rtrees...]
+[done]
+
+Auto generate the toupper / tolower from i18n.c  Eliminate i18n.c
+[done]
+Accept character classes, not just UTF-8 in syntax files.
+[done]
+
+Improve speed of regex? Compile to perfect hash? At least sort the
+intervals?
+[done]
+
+[fixed]
+we parse strings, which does escape processing.
+  but then we call parse_class on the parse string which also does escape processing.
+build should report return value of make
+[done]
+
+grep and build should switch to the current directory first.
+   "scratch" needs to inherit current directory
+     hmm..
+     [done- also load "* Startup Log *" first to prevent inheriting- for
+example when we start shell windows]
+
+   "grep" and "build" need to change directory before running
+     [fixed]
+   parse already does the right thing
+
+ parsed file names with spaces not working correctly
+ parse file names with no line numbers?
+ [fixed]
+
+ add shell commands to other rc files
+ [done]
+
+ status command should use status line escape sequences
+ [done]
+
+ messages from shell windows sometimes do not show up.  The issue is that
+when we close a prompt window, we resize the shell window.  This causes bash
+to redraw the line.  This input counts as typing and causes the message to
+be erased (it just causes a screen update which notices the updtab flag
+set).. We need some other way (than setting updtab) to clear the message-
+maybe set updtab on next user input.
+ [fixed- now we remove message only on user input, not shell input]
+
+ security hole with "math"
+ [fixed]
+
+ parserr - it would be nice if parsing was limited to a block
+ [done]
+
+ parserr - no way to turn off highlighting line (but ESC space is OK).
+ [fixed: added release command]
+
+ 'parserr' leaving many copies of buffer?
+ [fixed]
+
+ message printed when we close last window and switch to orphan buffer
+ [fixed- now we always do it, but can turn off with noexmsg]
+
+ shell joe command doesn't work with absolute path if prefix is added.
+ this doesn't work well with ^KE either (need to clear path manually)
+   emacs does some magic here.. if it detects // it ignores prefix
+     two parts:
+       it displays prefix with { }
+       when opening file, it starts with the /
+ [fixed- now we do same as emacs]
+
+ when we 'edit' in a shell window, it should pop before loading the new one.
+  otherwise we get a bunch of copies of the shell window I think
+ [fixed]
+
+ Esc sequences could be optimized out: delete one if it results in same
+ attributes that already exist
+ [done]
+
+ check for n^2 algorithms
+ [done]
+
+Pgetc() does not now always return a character... this breaks paragraph
+formatter and anything that expect binsc(pgetc) to work.
+ [fixed: we assign a code for each ansi sequence]
+
+ clean up macro execute for magic shell commands:
+   only execute shell_ ones...
+   only execute if window is on screen...
+   how do we allow "file"?  it should only be allowed in prompts, and not
+   allowed to be typed into the shell.
+ [done]
+
+ Need per-shell window current directory.
+  Logbuf?  Sometimes?
+ [done: the buffer records the current directory]
+
+ color on status line gets messed up when shell text is colored.. how can
+this even happen?
+ [fixed] 
+
+ cursor in wrong position when I abort a window and shell window gets pulled
+on.. need EFIXXCOL, but joe crashes when I enable it for abort command.
+ abort a window and shell window replaces it:
+   cursor is wrong. we need EFFIXCOL on abort.. any others?
+  [fixed]
+
+ 'joe' in a shell window should edit a file.
+[done]
+
+Think more about keeping cursor in sync: from shell window, edit file, ^C,
+we're back in shell window but cursor is in the wrong place.
+ [fixed- we were not keeping cursor up to date in orphan windows]
+
+nbuf/pbuf do not call resize, so swapping in a shell window is not properly resized.
+ [seems to be fixed, but not sure where resize is getting called..]
+
+multiple windows open on one shell window is kind of broken (you get
+conflicting resize events from each of them).  There should be a concept
+of the master window.
+ [fixed, we use the last one]
+
+Need raw mode which works the old way.. (mostly for debugging joe..)
+  [done]
+
+Resize needs more testing.  Resize with 'man ls' not quite working.
+Weird things will happen with multiple window with synchronized cursors.
+   [fixed- was due to scrolling region not being resized]
+
+Resize not working when you kill other window?
+ [seems to be ok]
+
+^K V should jump to vt cursor... (done)
+
+UTF-8 syntax files?
+[done]
+
+utils.c:parse_ident not using utf8?
+[done: now allows utf8 identifiers]
+
+move getcodeset stuff from utf8.c -> charmap
+[done]
+
+Ctrl-G logic bugs:
+  xml with utf-8 chars: does not jump to first char, we must be assuming
+chars are bytes
+  there is delimiter buffer but it's bytes, not chars
+[done]
+
+tomatch_xml: does not handle unicode names
+[done]
+
+umath use joe_isalpha_? problem is we eval a char buffer, not an editor
+buffer.
+ [fixed]
+
+fwrd_c and utf8_decode_fwrd output is not directly compatible with joe_is
+functions.  But pgetc and brch output is.
+[done- now they return UTF8_XXX which is outside of negative character range]
+
+  - check all other users of joe_is...
+     - options.c, rc.c
+     - sometimes we use brc and brch for joe_isblank
+   [done]
+
+check yncheck..
+[modifed to convert to locale if necessary]
+
+macros.c: unescape seems broken
+ [fixed - but it would be nice if the buffer sizes were not limited]
+
+"-wrap" is messing up isrch somehow
+[fixed]
+
+
+New regex engine:
+      add case ignore:
+          done, however right now we do simple folding for classes and full
+          folding outside of classes.  I think maybe better to do simple
+          folding for both?  Any point of full folding without
+          normalization?
+
+      unicode normalization, ugh.  Maybe this should be optional.
+      have an option 'n' for normalized search?
+
+      check performance and memory leaks
+
+      add \c
+      [done]
+
+      optional standard regex syntax?
+      [done]
+
+      add code to allow use of boyer-moore
+      [done: we even do it on utf-8 if we can (if there is no case folding)]
+
+      handle byte encoding correctly- we are only handling unicode
+        - what happens if you search/replace across file with different
+          encodings? maybe recompile for each file?  Actually we are already
+          recompiling for this case. [nope, we give an error if you try it]
+      [Done: character classes are converted to byte code]
+
+      syntax ok? update help if it is..
+      [done]
+
+      check char to int promotions [done].
+
+Now that we have new regex engine:
+      switch to it for ftyperc? [done]
+
+Reformat long line is too slow
+ [improved, but look into prgetc improvement also]
+
+Improve syntax files to work with unicode.
+[done (but we can always do more..)]
+