Commit Graph

38 Commits

Author SHA1 Message Date
deraadt
ab73997cc5 use reallocarray instead of calloc; avoid the zero before infill
ok nicm
2015-04-23 07:45:50 +00:00
nicm
a27ba6e380 Add xreallocarray and remove nmemb argument from xrealloc. 2014-10-08 17:35:58 +00:00
nicm
77efcf8bdd Use xrealloc(NULL, n, m) instead of xmalloc(n * m) to get overflow
check.
2014-10-08 17:14:04 +00:00
nicm
21062d74d5 Fix some comments (c -> colour) and join unnecessary line splits. 2014-09-17 15:31:38 +00:00
nicm
4e956d545a Various minor style and spacing nits. 2014-09-01 21:50:18 +00:00
nicm
5acee1c04e Memory leak in error path and unnecessary assignment, from clang. 2014-04-16 23:05:38 +00:00
nicm
7bdb675469 GRID_DEBUG is no longer needed. 2014-03-31 21:42:27 +00:00
nicm
f835be4bb2 Style nit - no space between function name and bracket. 2014-02-14 13:59:01 +00:00
nicm
945339b443 Allow replacing each of the many sets of separate foo-{fg,bg,attr}
options with a single foo-style option. For example:

    set -g status-fg yellow
    set -g status-bg red
    set -g status-attr blink

Becomes:

    set -g status-style fg=yellow,bg=red,blink

The -a flag to set can be used to add to rather than replace a style. So:

    set -g status-bg red

Becomes:

    set -ag status-style bg=red

Currently this is fully backwards compatible (all *-{fg,bg,attr} options
remain) but the plan is to deprecate them over time.

From Tiago Cunha.
2014-01-28 23:07:09 +00:00
nicm
3368b602a8 Couple of fixes from cppcheck via Tiago Cunha. 2014-01-15 11:44:18 +00:00
nicm
994cb872cf Style and comment fixes from Tiago Cunha. 2014-01-09 13:58:06 +00:00
nicm
1b7c2dd056 Trivial style and spacing nits. 2013-10-10 12:01:14 +00:00
nicm
7839993fe7 Only include actual trailing spaces not unused cells with capturep -J,
from George Nachman.
2013-10-10 11:49:29 +00:00
Nicholas Marriott
304336a591 Allow lastgc to be NULL in grid_string_cells so find-window doesn't
crash, problem reported by eugene everson.
2013-03-25 10:07:40 +00:00
Nicholas Marriott
295d86911e Add -C and -J to capture pane to escape control sequences and to join
wrapped line, based on a diff from George Nachman.
2013-03-22 15:56:11 +00:00
Nicholas Marriott
9b7e18f166 Rework reflow code so it does not do so much allocation which should be
faster with large histories.
2013-03-21 16:12:10 +00:00
Nicholas Marriott
8903c1f167 Automatically reflow wrapped lines when a pane is resized, requested by
many over the years and finally implemented by Richard Woodbury.
2013-02-05 11:08:59 +00:00
Nicholas Marriott
fdbfc7e349 Rather than having two grids for each pane, one for ASCII and one for
UTF-8, collapse the two together. Simplifies the code at the expense of
more memory (which can probably be reduced again later).
2013-01-18 02:16:21 +00:00
Nicholas Marriott
df912e3540 xfree is not particularly helpful, remove it. From Thomas Adam. 2012-07-10 11:53:01 +00:00
Nicholas Marriott
1f23f6d686 Use a predefined structure for not-space cells used to set attributes. 2012-05-23 19:19:40 +00:00
Nicholas Marriott
ac9daf92d7 Merge copy mode and output mode, dropping the latter. Idea and code from
Micah Cowan.
2010-04-06 21:35:44 +00:00
Nicholas Marriott
15a64b805e Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...
2009-12-03 22:50:09 +00:00
Nicholas Marriott
a78cc98c8b Cleanup by moving various (mostly horrible) little bits handling UTF-8 grid
data into functions in a new file, grid-utf8.c, and use sizeof intead of
UTF8_DATA.

Also nuke trailing whitespace from tmux.1, reminded by jmc.
2009-11-18 17:02:17 +00:00
Nicholas Marriott
ad566a86de Move lines into the history when scrolling even if the scroll region is not
the entire screen.

Allows ircII users to see history, prompted by naddy.
2009-10-13 15:38:37 +00:00
Nicholas Marriott
4278199101 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 15:14:09 +00:00
Nicholas Marriott
0198bb6bf3 Fix grid_expand_line so it actually works when the required size is bigger than
2 * the current size.
2009-08-21 07:29:37 +00:00
Nicholas Marriott
1501b3fbbd 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-20 19:14:42 +00:00
Nicholas Marriott
fa64c1235e Use the right source and destination lines in grid_duplicate_lines. 2009-08-10 17:59:59 +00:00
Nicholas Marriott
5e01b6d663 Change the way the grid is stored, previously it was:
- a two-dimensional array of cells;
- a two-dimensional array of utf8 data;
- an array of line lengths.

Now it is a single array of a new struct grid_line each of which represents a
line and containts the length and an array of cells and an array of utf8 data.

This will make it easier to add additional per-line members, such as flags.
2009-08-08 13:29:27 +00:00
Nicholas Marriott
044ebf1952 Remove a couple of unused functions and fix a type ("FALLTHOUGH"), found by
lint.
2009-07-21 18:40:30 +00:00
Nicholas Marriott
924bf8477f Typo in grid_duplicate_lines (sy for dy) causing it to write into the wrong
place when copying UTF-8 data. Found by Dan Colish.
2009-07-16 07:34:37 +00:00
Nicholas Marriott
359285928b Support "alternate screen" mode (terminfo smcup/rmcup) typically used by full
screen interactive programs to preserve the screen contents. When activated, it
saves a copy of the visible grid and disables scrolling into and resizing out
of the history; when deactivated the visible data is restored and the history
reenabled.
2009-07-13 10:43:52 +00:00
Nicholas Marriott
bd098c273b Limit the history to hlimit not hlimit - 1. This makes a history-limit setting
of 0 work as expected.
2009-07-11 20:11:18 +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
7e796dea03 Change find-window and monitor-content to use fnmatch(3). For convenience and
compatibility, *s are implicitly added at the start and end of the pattern.

Also display the line number and the entire line in the results, and lose the
nasty section_string function and the now empty util.c file.

Initially from Tiago Cunha.
2009-06-24 22:49:56 +00:00
Nicholas Marriott
096cbf2ea5 Add a dedicated function to convert a line into a string and use it to simplify the search window function. 2009-06-24 22:04:18 +00:00
Ray Lai
74749e8705 Remove trailing newlines, spaces, and tabs.
No binary change.
2009-06-05 03:13:16 +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