Commit Graph

133 Commits (153ae758c92207d34d4fe6f41779cf1ce3213d59)

Author SHA1 Message Date
nicm 8149bc3fa6 Be more strict about escape sequences that rename windows or set titles:
ignore any that not valid UTF-8 outright, and for good measure pass the
result through our UTF-8-aware vis(3).
2017-06-04 09:02:36 +00:00
Thomas Adam 73b9328c1f Merge branch 'obsd-master'
Conflicts:
	window-buffer.c
2017-06-01 18:29:36 +01:00
nicm 248aa54bfd Style and spacing nits. 2017-05-31 17:56:48 +00:00
Nicholas Marriott c2b53598ad Bad merge. 2017-03-21 14:48:44 +00:00
nicm 67d2335130 Fix a couple of argument types. 2017-03-17 14:51:41 +00:00
Thomas Adam 044999ce6d Merge branch 'obsd-master' 2017-01-18 12:01:11 +00:00
nicm faa0570309 Plain stravis() because it will mangle UTF-8 characters, so add
utf8_stravis() which calls our existing utf8_strvis() and use it instead
2017-01-18 10:08:05 +00:00
Thomas Adam b9dc855016 Merge branch 'obsd-master'
Conflicts:
	format.c
	osdep-openbsd.c
2016-10-12 09:45:49 +01:00
nicm 8b804fb589 Support UTF-8 entry into the command prompt. 2016-10-11 07:11:40 +00:00
Nicholas Marriott 6c94774b70 Add support for using utf8proc with --enable-utf8proc, useful for platforms
(like OS X) where the system implementation is crap. From Joshua Rubin.
2016-09-01 20:40:03 +01:00
Thomas Adam 7a2fed494b Merge branch 'obsd-master' 2016-05-28 02:01:10 +01:00
nicm 9892d80d6f Most of the utf8_data is fixed so simplify utf8_set to use a memcpy. 2016-05-27 22:57:27 +00:00
Nicholas Marriott 65e4c57d3a Only assume width 1 when wcwidth() returns -1 on non-OpenBSD platforms. 2016-04-29 12:47:15 +01:00
Thomas Adam a9d501e975 Merge branch 'obsd-master' 2016-04-29 12:01:09 +01:00
nicm 7abdfbe20e OpenBSD wcwidth() is sensible and complete so if it returns -1 it means
that a character is not printable, so return to ignoring such
characters.
2016-04-29 09:11:19 +00:00
Thomas Adam 55fdaab365 Merge branch 'obsd-master' 2016-04-27 12:01:10 +01:00
nicm 23fdbc9ea6 Loads of platforms appear to have old or broken Unicode character type
information and are missing widths for relatively common Unicode
characters (so mbtowc() works, but wcwidth() fails). So if wcwidth()
returns -1, assume a width of 1 instead of ignoring the character.
2016-04-27 09:36:25 +00:00
Thomas Adam 819ad1a007 Merge branch 'obsd-master' 2016-04-26 10:01:16 +01:00
nicm d303e55258 Log wcwidth() and mbtowc() failure to make it easier to debug a Unicode
codepoint not appearing.
2016-04-26 07:33:36 +00:00
Nicholas Marriott 9e2fbb31ec +wchar.h 2016-03-02 18:19:13 +00:00
Thomas Adam e304673c65 Merge branch 'obsd-master'
Conflicts:
	utf8.c
2016-03-02 18:10:51 +00:00
nicm b8a102d26f Handle wcwidth() and mbtowc() failures in better style and drop
characters where we can't find the width (wcwidth() fails) on input, the
same as we drop invalid UTF-8. Suggested by schwarze@.
2016-03-02 15:36:02 +00:00
nicm 26945d7956 Use system wcwidth() instead of carrying around UTF-8 width tables. 2016-03-01 12:02:08 +00:00
Thomas Adam 5fce21728e Merge branch 'obsd-master' 2016-01-31 12:01:09 +00:00
nicm fa64b89ad7 Whoops, need this for the previous reverse trim commit too. 2016-01-31 09:57:41 +00:00
Thomas Adam dc42c35f1f Merge branch 'obsd-master' 2016-01-19 18:01:15 +00:00
nicm 995af0e2b7 I no longer use my SourceForge address so replace it. 2016-01-19 15:59:12 +00:00
Thomas Adam 78a00c845c Merge branch 'obsd-master'
Conflicts:
	tmux.h
2015-11-21 14:24:33 +00:00
nicm 933929cd62 Memory leaks and an uninitialized part of utf8_data, from Patrick Palka. 2015-11-20 22:02:54 +00:00
Thomas Adam bb820fa761 Merge branch 'obsd-master' 2015-11-14 14:01:08 +00:00
nicm 3db0d50df4 The private use area at U+E000 to U+F8FF is not very useful if it is
width 0, make it width 1 instead.
2015-11-14 12:03:23 +00:00
Thomas Adam f12d7f0d4b Merge branch 'obsd-master' 2015-11-14 12:01:09 +00:00
nicm 205d15e82d All these return values from utf8_* are confusing, use an enum. 2015-11-14 11:45:43 +00:00
Thomas Adam 7b4b78b419 Merge branch 'obsd-master' 2015-11-14 11:38:52 +00:00
nicm f401791a56 Rename a variable in utf8_combine for consistency and use 0xfffd for
unknown Unicode.
2015-11-14 11:13:44 +00:00
nicm 64333e3ef8 Be more strict about invalid UTF-8. 2015-11-14 10:56:31 +00:00
Thomas Adam 3df4959f51 Merge branch 'obsd-master'
Conflicts:
	Makefile
2015-11-13 10:42:45 +00:00
nicm c5689a5a40 Long overdue change to the way we store cells in the grid: now, instead
of storing a full grid_cell with UTF-8 data and everything, store a new
type grid_cell_entry. This can either be the cell itself (for ASCII
cells), or an offset into an extended array (per line) for UTF-8
data.

This avoid a large (8 byte) overhead on non-UTF-8 cells (by far the
majority for most users) without the complexity of the shadow array we
had before. Grid memory without any UTF-8 is about half.

The disadvantage that cells can no longer be modified in place and need
to be copied out of the grid and back but it turned out to be lot less
complicated than I expected.
2015-11-13 08:09:28 +00:00
Thomas Adam a7027ed8e5 Merge branch 'obsd-master' 2015-11-13 00:01:15 +00:00
nicm e71a915412 Rename overly-long utf8data to ud throughout. 2015-11-12 22:04:37 +00:00
Thomas Adam 4f88344df3 Merge branch 'obsd-master' 2015-11-12 14:01:14 +00:00
nicm a209ea3953 Add utf8_padcstr and use it to align columns in list-keys. 2015-11-12 12:43:36 +00:00
nicm d6daf37df4 Tidy utf8.c a little: build table on first use, and make utf8_width take
a u_int rather than splitting and then combining again in utf8_split.
2015-11-12 12:19:57 +00:00
Thomas Adam 5f483499f3 Merge branch 'obsd-master' 2015-11-12 12:01:17 +00:00
nicm c41673f3fa If we know the terminal outside tmux is not UTF-8, replace UTF-8 in
error messages and whatnot with underscores the same as we do when we
draw UTF-8 characters as part of the screen.
2015-11-12 11:10:50 +00:00
nicm 69e0b8326a Support UTF-8 key bindings by expanding the key type from int to
uint64_t and converting UTF-8 to Unicode on input and the reverse on
output. (This allows key bindings, there are still omissions - the
largest being that the various prompts do not accept UTF-8.)
2015-11-12 11:05:34 +00:00
Thomas Adam 35fd6d134a Merge branch 'obsd-master'
Conflicts:
	utf8.c
2015-11-11 08:14:36 +00:00
schwarze e9b58d9de4 Update the internal wcwidth(3) table of tmux(1) to match the data
in /usr/src/share/locale/ctype/en_US.UTF-8.src, with one single
exception:  Keep U+00AD SOFT HYPHEN at width 1 rather than moving
it to width 0, a tradition already observed in the old
https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c .
While here, manually rebalance the btree for optimal lookup speed.
OK nicm@
2015-11-05 16:44:25 +00:00
Thomas Adam 0a88377086 Merge branch 'obsd-master' 2015-04-22 10:05:54 +01:00
nicm 3497843f02 Style nit - unnecessary brackets. 2015-04-20 14:48:55 +00:00
Nicholas Marriott 747cab4281 No need for $Id$ now. 2014-11-08 12:27:43 +00:00
Thomas Adam 562af864bd Merge branch 'obsd-master'
Conflicts:
	Makefile
	cmd-list-commands.c
	cmd-suspend-client.c
	job.c
	tmux.h
	xmalloc.c
2014-10-21 07:11:44 +01:00
nicm a27ba6e380 Add xreallocarray and remove nmemb argument from xrealloc. 2014-10-08 17:35:58 +00:00
Thomas Adam 953c3ef47a Merge branch 'obsd-master'
Conflicts:
	Makefile
	tmux.1
	window.c
2014-04-23 11:26:11 +01:00
nicm 806520f025 Add some UTF-8 utility functions and use them to prevent the width limit
on formats from splitting UTF-8 characters improperly.
2014-04-17 15:37:55 +00:00
nicm a5d4b7f3d9 Some more long lines. 2014-04-17 14:45:49 +00:00
Thomas Adam 57c514d2f8 Remove <vis.h>; not used on Linux. 2014-04-05 12:40:19 +01:00
Thomas Adam 0c99c7dbff Merge branch 'obsd-master'
Conflicts:
	Makefile
	tty-keys.c
2014-04-05 12:36:14 +01:00
nicm 252a7373d6 Support UTF-8 with choose-buffer, from Kosuke ASAMI. Also make
buffer_sample bigger to let it trim at window right edge.
2014-04-02 18:12:18 +00:00
nicm ee19d304ff In four byte UTF-8 sequences, only three bits of the first byte should
be used. Fix from Koga Osamu.
2014-03-31 21:43:35 +00:00
Nicholas Marriott 7019f77c05 In four byte UTF-8 sequences, only three bits of the first byte should be
used. Fix from Koga Osamu.
2014-03-08 16:27:45 +00:00
Thomas Adam b58bca9a72 Merge branch 'obsd-master'
Conflicts:
	tmux.c
2013-04-13 17:05:49 +01:00
Nicholas Marriott 27dcf470dc Remove some Korean characters from the zero-width list that apparently
shouldn't be there, from Jeong Mok Cho.
2013-04-12 12:50:36 +00:00
Nicholas Marriott 5b85efeb93 Fix some UTF-8 Japanese issue on OS X, SF bug 3566884. 2012-09-24 13:56:32 +01:00
Tiago Cunha 391f1f08c0 Expand the Id keyword. 2011-07-09 09:42:33 +00:00
Tiago Cunha 219442cff7 Sync OpenBSD patchset 828:
Support for UTF-8 mouse input (\033[1005h). This was added in xterm 262
and supports larger terminals than the older way.

If the new mouse-utf8 option is on, UTF-8 mouse input is enabled for all
UTF-8 terminals. The option defaults to on if LANG etc are set in the
same manner as the utf8 option.

With help and based on code from hsim at gmx.li.
2011-01-07 14:34:45 +00:00
Nicholas Marriott ac3b78a841 Support for UTF-8 mouse input (\033[1005h). This was added in xterm 262
and supports larger terminals than the older way.

If the new mouse-utf8 option is on, UTF-8 mouse input is enabled for all
UTF-8 terminals. The option defaults to on if LANG etc are set in the
same manner as the utf8 option.

With help and based on code from hsim at gmx.li.
2011-01-03 23:35:21 +00:00
Tiago Cunha 21b23f8e54 Sync OpenBSD patchset 424:
%zu not %u, doh.
2009-10-23 17:21:34 +00:00
Tiago Cunha f41a3914a5 Sync OpenBSD patchset 421:
Try to reduce the UTF-8 mess.

Get rid of passing around u_char[4]s and define a struct utf8_data which has
character data, size (sequence length) and width. Move UTF-8 character
collection into two functions utf8_open/utf8_append in utf8.c which fill in
this struct and use these functions from input.c and the various functions in
screen-write.c.

Space for rather more data than is necessary for one UTF-8 sequence is in the
utf8_data struct because screen_write_copy is still nasty and needs to reinject
the character (after combining) into screen_write_cell.
2009-10-23 17:16:25 +00:00
Nicholas Marriott 9afb0d739e %zu not %u, doh. 2009-10-20 22:17:33 +00:00
Nicholas Marriott 1af09d6330 Try to reduce the UTF-8 mess.
Get rid of passing around u_char[4]s and define a struct utf8_data which has
character data, size (sequence length) and width. Move UTF-8 character
collection into two functions utf8_open/utf8_append in utf8.c which fill in
this struct and use these functions from input.c and the various functions in
screen-write.c.

Space for rather more data than is necessary for one UTF-8 sequence is in the
utf8_data struct because screen_write_copy is still nasty and needs to reinject
the character (after combining) into screen_write_cell.
2009-10-20 19:18:28 +00:00
Nicholas Marriott a5830b9603 Restore $Id$ and add script to do so. 2009-06-25 16:21:32 +00:00
Nicholas Marriott 582660bdf3 Miscellaneous unused functions, including one which was basically a
duplicate. Found by lint.
2009-06-25 16:09:11 +00:00
Nicholas Marriott 245685433e Constify utf8_width() function argument. 2009-06-25 16:00:50 +00:00
Nicholas Marriott 1675ddb4d1 Miscellaneous unused functions, including one which was basically a
duplicate. Found by lint.
2009-06-25 06:15:04 +00:00
Nicholas Marriott 27cfa81110 Constify utf8_width() function argument. 2009-06-24 05:35:07 +00:00
Nicholas Marriott 35876eaab9 Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti
2009-06-01 22:58:49 +00:00
Nicholas Marriott 143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott a6f2d82335 Use a (pre)randomised binary tree for UTF-8 character widths. Probably overkill
but meh.
2009-04-30 20:54:53 +00:00
Nicholas Marriott 4d7e555a48 Don't screw up UTF-8 combined characters. 2009-01-26 20:57:45 +00:00
Nicholas Marriott ff61eee294 Don't use [4] since they are confusing and use the right size for memset. DOH. 2009-01-17 18:38:12 +00:00
Nicholas Marriott efe557313a Internal screen data rewrite for better 256 colour/UTF-8 support. 2008-09-25 20:08:57 +00:00
Nicholas Marriott 19a2c87f04 Initial UTF-8 support. 2008-09-09 22:16:37 +00:00