Commit graph

367 commits

Author SHA1 Message Date
Daniel Eklöf
2c101a21ee
config: add font-bold, font-italic and font-bold-italic options
These options lets the user configure custom fonts and styles, to use
with the bold and italic cell attributes.

By default, they are unset, meaning we use the bold/italic variants of
the regular font.

Closes #169.
2020-10-20 21:04:47 +02:00
Daniel Eklöf
e6737034e5
term: reset: enable/disable cursor blink depending on user configuration 2020-10-13 19:28:56 +02:00
Daniel Eklöf
2cac832ef3
term: reset: kill blink timer 2020-10-13 19:28:42 +02:00
Daniel Eklöf
1f650a7fdf
term: remove unneeded blink.active field
We now use the timer FD instead; if it is -1, blinking is not active.
2020-10-13 19:28:05 +02:00
Daniel Eklöf
ac55e4067a
term: instantiate cursor blink timer on-demand 2020-10-13 19:23:04 +02:00
Daniel Eklöf
c63199429e
term: create/destroy blink timer on-demand
Blinking text is uncommon. It doesn’t make that much sense to keep a
timer opened (but unarmed) at all times.

This patch makes it so the timer is instantiated on-demand, and
destroyed again when it no longer is needed.
2020-10-13 18:40:20 +02:00
Daniel Eklöf
7a218cba08
term: subpixel changed: fix build with LOG_ENABLE_DBG=1 2020-10-13 18:39:36 +02:00
Daniel Eklöf
d75e50230e
Merge branch 'scroll-up-down-while-selecting' into master
Closes #149
2020-10-12 20:20:26 +02:00
Daniel Eklöf
17761dce63
csi: implement ‘CSI ? 1042 h/l’ - enable/disable bell-is-urgent 2020-10-11 17:44:29 +02:00
Daniel Eklöf
7fedf2f801
selection: auto-scroll: selection keeps scrolling while mouse is outside grid
Moving the mouse outside the grid while we have an on-going selection
now starts a timer. The interval of this timer depends on the mouse’s
distance from the grid - the further away the mouse is, the shorter
interval.

On each timer timeout, we scroll one line, and update the
selection. Thus, the shorter the interval, the faster we scroll.

The timer is canceled as soon as the mouse enters the grid again, or
the selection is either canceled or finalized.

The timer FD is created and destroyed on-demand.

Most of the logic is now in selection.c. The exception is the
calculation of the timer interval, which depends on the mouse’s
position. Thus, this is done in input.c.

The scroll+selection update logic needs to know a) which direction
we’re scrolling in, and b) which *column* the selection should be
updated with.

If the mouse is outside the grid’s left or right margins, the stored
mouse column will be -1. I.e. we don’t know whether the mouse is on
the left or right side of the grid. This is why the caller, that
starts the timer, must provide this value.

The same applies to top and bottom margins, but since we already have
the scroll *direction*, which row value to use can be derived from this.
2020-10-11 15:44:20 +02:00
Daniel Eklöf
892730e5b9
term: update sixel rows/cols *after* cell dimension change, *before* resize
This fixes an issue where we resized+reflowed with bad rows/cols
values in the sixels.
2020-10-09 07:44:16 +02:00
Daniel Eklöf
6cf86d67d9
term: re-calculate sixel images’ rows/cols values when cell size changes 2020-10-09 07:44:15 +02:00
Daniel Eklöf
7c6686221f
bell: optionally render margins in red when receiving BEL
Add anew config option, ‘bell=none|set-urgency’. When set to
‘set-urgency’, the margins will be painted in red (if the window did
not have keyboard focus).

This is intended as a cheap replacement for the ‘urgency’ hint, that
doesn’t (yet) exist on Wayland.

Closes #157
2020-10-08 19:55:32 +02:00
Daniel Eklöf
9f9ad69849
term: cursor-left: unlikely -> likely for reverse-wrap
Since reverse wrap-around is enabled by default, we’re *likely* to
take this branch.
2020-10-06 19:05:11 +02:00
Daniel Eklöf
207b24538d
term: enable reverse wrap-around by default
Since we’re now doing reverse auto-wrapping by default, we add
‘bw’ (‘auto_left_margin’)to terminfo.
2020-10-06 18:42:26 +02:00
Daniel Eklöf
97e07c1ea1
term: cursor-left: don’t do reverse-wrapping unless auto-margins are enabled
This matches XTerm’s behavior.
2020-10-03 10:50:28 +02:00
Daniel Eklöf
03cacaba86
term: cursor-left: reverse-wrap when cursor is at the left margin
Assuming the private mode ‘reverse-wrap’ has been enabled.
2020-10-02 21:30:32 +02:00
Daniel Eklöf
5594746e49
Revert "term: cursor-left: reduce move count by one when lcf=true"
This reverts commit 02e3e4ac9b.

This broke at least Emacs. Cursor movement at the margins *is*
undefined, and the behavior we’re now reverting to matches XTerm.
2020-10-02 20:02:36 +02:00
Daniel Eklöf
02e3e4ac9b
term: cursor-left: reduce move count by one when lcf=true
When lcf is true, cursor is actually beyond the right margin, but the
stored coordinate is at the margin.

This means we need to reduce the number of cells to move the cursor by
one.

This fixes an issue where e.g. backspacing when the cursor is at the
right margin erased the next-to-last character instead of the last
character.
2020-10-01 20:08:29 +02:00
Daniel Eklöf
5116e40581
term: add term_damage_cursor() and term_damage_margins()
term_damage_cursor() damages the cell where the cursor is currently
at. This can be used to ensure the cursor is re-drawn, if there aren’t
any other pending updates.

term_damage_margins() requests the margins be redrawn the next time we
render the grid.
2020-09-29 10:04:18 +02:00
Daniel Eklöf
f2497320c6
config: add mouse.alternate-scroll-mode option
This option controls the initial state of the Alternate Scroll Mode,
and defaults to ‘enabled’.
2020-09-15 19:12:29 +02:00
Daniel Eklöf
91a839bf8e
term: enqueue data: cleanup 2020-08-25 18:56:15 +02:00
Daniel Eklöf
e570146c07
selection: block non-paste data from being sent to client while pasting
While pasting data from the clipboard, block *all* other data from
being sent to the client. This includes keyboard and mouse events, but
also replies for VT queries.

This is particularly important when bracketed paste has been enabled,
since then the client will interpret *everything* between the
bracketed paste start and end as paste data.
2020-08-25 18:56:15 +02:00
Daniel Eklöf
dabdffafa5
don't use empty struct initializers 2020-08-23 10:07:00 +02:00
Daniel Eklöf
44557dc7cf
input: don't crash on mouse motion events on the render timer surface 2020-08-14 07:35:01 +02:00
Craig Barnes
7a77958ba2 Convert most dynamic allocations to use functions from xmalloc.h 2020-08-08 20:37:57 +01:00
Craig Barnes
7eb70a453b Replace GCC "unused" and "format" attributes with portable macros 2020-08-07 20:42:34 +01:00
Daniel Eklöf
4919ccbc70
term: remove unusued 'damage' list 2020-08-04 18:07:22 +02:00
Daniel Eklöf
d4ee9be4d7
config: add 'hide-when-typing'
When enabled, the mouse cursor is hidden when the user types in the
terminal. It is un-hidden when the user moves the mouse, or when the
window loses keyboard focus.
2020-07-31 17:09:06 +02:00
Daniel Eklöf
f6533a71e4
user-notification: 'productify' the user-warning system
* Rename user_warning to user_notification
* Add warning and error types (in addition to the existing deprecated)
* Simplify logic when emitting a user notification after forking; we
  don't need to copy the notification data since we're in a new
  process and have total control over that memory.
2020-07-30 18:58:54 +02:00
Daniel Eklöf
b3d0215c38
term: add capability to print warnings *inside* the terminal
This is intended to be used to print e.g. deprecation warnings inside
the terminal, *before* the shell is started.
2020-07-29 19:42:12 +02:00
Daniel Eklöf
295083059c
Merge branch 'master' into diagonal-dpi 2020-07-28 20:01:56 +02:00
Daniel Eklöf
76350c568e
term: term_surface_kind(): recognize the scrollback indicator sub-surface 2020-07-26 12:37:12 +02:00
Daniel Eklöf
6e909d5cd3
term: use the monitors diagonal DPI value, instead of it's vertical PPI value 2020-07-26 07:45:55 +02:00
Daniel Eklöf
b08db1ef97
term: store current font DPI as a float instead of an integer
FontConfig's DPI is a double, and using a float instead of an integer
results in higher resolution.
2020-07-26 07:45:03 +02:00
Daniel Eklöf
c4679e474e
config: rename scrollback-indicator to scrollback-indicator-style
And turn it from a boolean to an enum. It can be set to:

* `none` - disables the indicator
* `static` - always rendered near the top of the window
* `moving` - position reflects the scrollback position
2020-07-25 14:31:45 +02:00
Daniel Eklöf
de75a2035e
Merge branch 'master' into pipe-grid-to-external-tool 2020-07-16 08:53:20 +02:00
Daniel Eklöf
7f6ed98a83
term: line-wrap: don't move cursor outside the grid
Remove assertion that row be less than the scrolling region end. The
cursor may in fact be *inside* the margin.

Inside the margin, content never scrolls, but we must make sure we
don't move the cursor outside the grid.
2020-07-16 08:47:37 +02:00
Daniel Eklöf
6f2cffd8c0
vt: never call term_print() with a width <= 0 2020-07-16 08:04:12 +02:00
Daniel Eklöf
69d9ff3f25
spawn: add optional stdin/stdout/stderr redirection FDs
If not -1, spawn() will redirect the child's stdin/stdout/stderr to
these FDs.
2020-07-15 13:33:56 +02:00
Daniel Eklöf
9cdccdd2ac
term: break out fork+exec functionality to a separate file 2020-07-15 12:39:10 +02:00
Daniel Eklöf
4d17423ed1
term: add term_scrollback_to_text() and term_view_to_text()
These functions extract the current view, or the entire scrollback as
an UTF-8 encoded byte buffer.
2020-07-15 11:33:37 +02:00
Max Hollmann
54e2b0b005 limit font size to non-negative values 2020-07-15 09:53:13 +02:00
Daniel Eklöf
2fa2c9fad4
term: print: don't pad with spacers if auto-margin is disabled 2020-07-15 08:04:51 +02:00
Daniel Eklöf
f962fb236e
term: copy current VT attributes to multi-column spacer cells
And refactor: break out spacer-writing code to a function, since we do
exactly the same thing in two places.
2020-07-14 20:24:52 +02:00
Daniel Eklöf
6d7aba3ea0
term: print: linewrap + insert *before* inserting SPACERS
Otherwise we end up overwriting the character in the last column
2020-07-14 17:03:20 +02:00
Daniel Eklöf
df2927e088
term: print: write special value CELL_MULT_COL_SPACER to extra cells
When printing a multi-column character, write CELL_MULT_COL_SPACER
instead of '0' to both padding cells (when character doesn't fit at
the end of the line), and to the cells following the actual character.
2020-07-14 16:49:11 +02:00
Daniel Eklöf
4cf7195695
selection: recognize empty padding cells in a forced linewrap
When printing a multi-column character at the end of the line, and it
doesn't fit, we currently insert a forced line-wrap. This means the
last character(s) on the previous line will be empty, followed by a
multi-column character in the first cell on the next line.

Without special code to handle this, the selection text extraction
code will insert a hard newline, since this is normally the correct
thing to do.

Add a TODO, to consider writing a special place holder value to these
padding cells.
2020-07-14 13:17:50 +02:00
Daniel Eklöf
7480c1c06b
term: remove assert, as we're already checking for this in the loop condition 2020-07-14 12:07:12 +02:00
Daniel Eklöf
b035469a7f
term: print: manually increment cursor column
We know we're within bounds, and thus we don't need the extra overhead
of term_cursor_right().
2020-07-14 12:05:24 +02:00