Commit Graph

74 Commits

Author SHA1 Message Date
Tiago Cunha
8ab3a3d9aa Sync OpenBSD patchset 394:
Permit attributes to be turned off in #[] by prefixing with "no", for example
"noblink".
2009-10-15 01:31:38 +00:00
Tiago Cunha
c507bf25de Sync OpenBSD patchset 328:
Stick line length to what is actually used (removing an optimization that
allowed it to be bigger), and use clear line/EOL sequences rather than spaces
in copy/scroll mode.

This fixes xterm copy/paste from tmux which treats trailing spaces differently
from clearing a line with the escape sequences. Reported by martynas@.
2009-09-15 23:54:57 +00:00
Tiago Cunha
0ec1ce005c Sync OpenBSD patchset 322:
Permit options such as status-bg to be configured using the entire 256 colour
palette by setting "colour0" to "colour255".
2009-09-11 14:13:52 +00:00
Tiago Cunha
5edc465802 Sync OpenBSD patchset 317:
Permit embedded colour and attributes in status-left and status-right using new
#[] special characters, for example #[fg=red,bg=blue,blink].
2009-09-07 23:37:48 +00:00
Tiago Cunha
1fa8a8f4a6 Sync OpenBSD patchset 285:
Ugh, committed the wrong version of this change and got both solutions rather
than just the second. Remove unused assignment.
2009-08-21 21:13:20 +00:00
Tiago Cunha
4b883524d8 Sync OpenBSD patchset 282:
A few trivial optimisations: no need to check for zero size if calling
buffer_ensure in buffer.c; expand grid lines by a greater increase than one
each time; and don't read UTF-8 data unless it actually needs to be checked
when overwriting a cell.
2009-08-21 21:09:13 +00:00
Tiago Cunha
78c789e1cb Sync OpenBSD patchset 252:
It was originally intended that scroll mode would show content that was
currently off-screen due to resize, but somewhere along the way this got
lost. Restore this behaviour to scroll mode by fixing screen_write_copy to read
up to the saved line length rather than the current screen width. Copy mode
remains unaltered for now.
2009-08-14 21:32:38 +00:00
Tiago Cunha
97eb537f38 Sync OpenBSD patchset 227:
Add a flags member to the grid_line struct and use it to differentiate lines
wrapped at the screen edge from those terminated by a newline. Then use this
when copying to combine wrapped lines together into one.
2009-08-09 17:32:06 +00:00
Tiago Cunha
09c6432854 Sync OpenBSD patchset 207:
Plug some memory leaks.
2009-07-30 21:14:04 +00:00
Tiago Cunha
7562781c9d Sync OpenBSD patchset 186:
Draw UTF-8 characters under the selection correctly.
2009-07-28 22:41:38 +00:00
Tiago Cunha
b72f9bea43 Sync OpenBSD patchset 162:
More tty code tidying: move the saved cursor/region position (from before the
screen was updated) out of struct screen and into struct tty_ctx.
2009-07-23 12:48:18 +00:00
Tiago Cunha
9c6fa90857 Sync OpenBSD patchset 160:
enum tty_cmd is only used as an index into the array of command function
pointers, so remove it and use the function pointers directly to represent
themselves.
2009-07-23 12:38:01 +00:00
Tiago Cunha
b6afa30c39 Sync OpenBSD patchset 159:
There are relatively few arguments to tty_cmd_* functions now, so tidy them up
by using a struct rather than hiding everything with varargs.
2009-07-22 18:08:56 +00:00
Tiago Cunha
75a44d856e Sync OpenBSD patchset 158:
tty_cmd_raw is only used once, for raw UTF-8 output, so rename it to
tty_cmd_utf8character and eliminate the size argument.
2009-07-22 17:58:42 +00:00
Nicholas Marriott
82b45b460e The scroll region cannot be one line only, ignore attempts to make it so. 2009-07-15 17:43:02 +00:00
Nicholas Marriott
664a0bd559 Cursor up and down should be limited by the scroll region (cuu should stop at
the scroll region top if starting from below it and cud stop at the bottom if
starting from above). Fixes another vttest test.
2009-07-09 18:08:13 +00:00
Nicholas Marriott
295879cced Change inserting and deleting lines inside the scroll region to properly clear
lines that should be inserted/deleted but not moved. Fixes problems with mutt
reported by Brian Lewis, thanks.
2009-07-09 18:04:53 +00:00
Nicholas Marriott
e073441c36 Tidy by removing unused argument from grid_view_{insert,delete}_line_region
functions (currently don't fully work, this is to make fix easier).
2009-07-09 18:04:17 +00:00
Nicholas Marriott
35092835b0 Fix two errors with character/line insertion and deletion: the maximum number
of characters which may be inserted or deleted is the screen width, not one
less (and similarly for lines and height); and if characters or lines are
deleted by moving the ones that follow, the space at the end needs to be
cleared.

This appears to solve long-standing redraw issues most visible when using the
force-width option then scrolling in view(1) or unwrapping lines in emacs.
2009-07-01 19:14:33 +00:00
Nicholas Marriott
1fb3948ff1 Whoops, revert. 2009-06-26 22:18:36 +00:00
Nicholas Marriott
1496aa5dbc Remove some unused function declarations; no binary change. 2009-06-26 22:18:03 +00:00
Nicholas Marriott
de2ea2d178 Status line fixes: don't truncate status-right now the length calculation is
done for UTF-8, limit to the maximum length correctly when printing, and always
print a space even if the left string is longer than the width available.
2009-06-26 15:34:12 +00:00
Nicholas Marriott
bb459beb03 Whitespace and more syncing. 2009-06-25 16:34:50 +00:00
Nicholas Marriott
a5830b9603 Restore $Id$ and add script to do so. 2009-06-25 16:21:32 +00:00
Nicholas Marriott
b8ec0c713f Support insert mode by using insert character to shift the cells before writing
as normal.
2009-06-25 15:52:12 +00:00
Nicholas Marriott
93631b3ca7 Implement the DEC alignment test. With the last change this is enough for the
first cursor test in vttest (in ports) to pass; it still shops a few more
problems though.
2009-06-25 15:51:54 +00:00
Nicholas Marriott
49477de55c Fix some miscalculations when clearing to start of screen: the number of lines
to the cursor is cy not cy - 1, and the current cursor cell should be included.
2009-06-25 15:50:48 +00:00
Nicholas Marriott
28bcf774e5 New session option, status-utf8, to control the interpretation of top-bit-set
characters in status-left and status-right (if on, they are treated as UTF-8;
otherwise passed through).
2009-06-25 15:48:25 +00:00
Nicholas Marriott
1e06ec41dc Add a UTF-8 aware string length function and make UTF-8 in
status-left/status-right work properly. At the moment any top-bit-set
characters are assumed to be UTF-8: a status-utf8 option to configure this will
come shortly.
2009-06-25 15:47:07 +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
8a160f2d58 - Unbreak selection colouring.
- Get UTF-8 check the right way round...
2009-03-30 20:14:50 +00:00
Nicholas Marriott
23fef99009 8 -> UTF8_SIZE. 2009-03-29 11:18:28 +00:00
Nicholas Marriott
4cbf7d489e - Ignore padding when writing so copying the screen for copy-mode doesn't include extra characters.
- Handle combined characters properly when the previous character is not UTF-8.
2009-03-29 11:06:22 +00:00
Nicholas Marriott
cf7b384c43 Better UTF-8 support, including combined characters. Unicode data is now stored
as UTF-8 in a separate array, the code does a lookup into this every time it
gets to a UTF-8 cell. Zero width characters are just appended onto the UTF-8
data for the previous cell. This also means that almost no bytes extra are
wasted non-Unicode data (yay).

Still some oddities, such as copy mode skips over wide characters in a strange
way, and the code could do with some tidying.
2009-03-28 20:17:29 +00:00
Nicholas Marriott
6c0728fe07 Step 2 of the Grand Plan To Make UTF-8 Better.
Split grid into two arrays, one containing grid attributes/flags/colours (keeps
the name grid_cell for now) and a separate with the character data (called
text). The text is stored as a u_short but is treated as a uint64_t elsewhere;
eventually the grid will have two arrays.

I'm not happy with the naming so that might change.

Still need to decide where to go from here. I'm not sure whether to combine
the peek/set functions together, and also whether to continue to treat the
text as a uint64_t (and convert to/from Unicode) or make it a char array
(of size one when UTF-8 disabled, eight when enabled) and keep everything
as UTF-8.

Also since UTF-8 will eventually become an attribute of the grid itself it
might be nice to move all the padding crap into grid.c.
2009-03-28 16:30:05 +00:00
Nicholas Marriott
989d67ccd7 struct grid_data -> struct grid. Stage 1 of the Grand Plan To Make UTF-8 Better. 2009-03-28 15:43:41 +00:00
Nicholas Marriott
8a6a7e74da CSR resets the cursor to the top-left. Reported by merdely. 2009-03-05 20:27:51 +00:00
Nicholas Marriott
eae026f2f7 Redraw selection properly. 2009-02-25 21:56:46 +00:00
Nicholas Marriott
c45eb2713b Check the right variable. Doh. 2009-02-24 21:49:05 +00:00
Nicholas Marriott
3969b59ae5 Don't turn cursor off unless actually drawing something. 2009-02-21 19:25:58 +00:00
Nicholas Marriott
514fe11727 We are going to need the updated screen data for emulating the scroll region,
which may involve changing the cursor position; however, the old (before
redraw) cursor position is necessary for writing to the tty. So, save it before
doing the redraw then update the internal screen then update the tty.

Not sure I like this solution but it does the job for now.
2009-02-11 17:04:39 +00:00
Nicholas Marriott
c6be7d3ee6 Simplify screen/tty write code to eliminate function pointer which is now
unnecessary (it always does the same thing).
2009-02-11 06:31:09 +00:00
Nicholas Marriott
4428987e95 * Better support for at least the most common variant of mouse input: parse it and adjust for different panes. Also support mouse in window/session choice mode.
* Bring back the fancy window titles with session/window names: it is easy to work around problems with elinks (see FAQ).
2009-01-28 19:52:21 +00:00
Nicholas Marriott
c1726281c9 Handle cursor on/off better. 2009-01-27 21:39:15 +00:00
Nicholas Marriott
4d7e555a48 Don't screw up UTF-8 combined characters. 2009-01-26 20:57:45 +00:00
Nicholas Marriott
95323a6a36 Leftover label. 2009-01-19 17:15:19 +00:00
Nicholas Marriott
4cdc228353 Unbreak UTF-8. 2009-01-18 21:46:30 +00:00
Nicholas Marriott
1fa36b2419 Use the right size. 2009-01-18 21:21:53 +00:00
Nicholas Marriott
0e197b417a Tidy a few warnings. 2009-01-17 18:47:37 +00:00