Commit graph

3336 commits

Author SHA1 Message Date
Daniel Eklöf
3863a61ba6
selection: find_word_boundary_{left,right}: handle multi-column characters 2021-01-04 19:48:42 +01:00
Daniel Eklöf
b22091a8c9
selection: find_word_boundary{left,right}: what we match depends on initial character
If the initial character is a space, find the next non-space
character.

If the initial character is a delimiter, find the next non-delimiter
character (space, or word character).

If the initial character is neither (i.e, it is a word character),
find the next non-word character.
2021-01-04 19:48:42 +01:00
Daniel Eklöf
2fd7b2fbd4
selection: allow selections to pivot around a range instead of a point
Extend selection pivoting to allow selections to pivot around a
range.

Use this in word- and row-based selections to pivot around the initial
word/row that was selected.

This mimics the behavior of at least urxvt and xterm.
2021-01-04 19:48:42 +01:00
Daniel Eklöf
c821914e67
selection: find_word_boundary{left,right}: handle composed characters 2021-01-04 19:48:41 +01:00
Daniel Eklöf
736ff0421c
selection: find_word_boundary_{left,right}: treat spacers as word chars 2021-01-04 19:48:41 +01:00
Daniel Eklöf
3afc5a723e
selection: use selection_start() to initialize word/row-based selection
This removes the selection_mark_word() and selection_mark_row()
functions. To start a word/row-based selection, use selection_start()
with SELECTION_SEMANTIC_{WORD,ROW}
2021-01-04 19:48:41 +01:00
Daniel Eklöf
3dd6b7e4ef
selection: don’t finalize selection when starting a word/row-based selection 2021-01-04 19:48:41 +01:00
Daniel Eklöf
bef69cb961
selection: remember whether word-wise selection uses spaces only for delimiters 2021-01-04 19:48:41 +01:00
Daniel Eklöf
a1b52ee4a0
changelog: double- or triple clicking then dragging extends word- or line-wise 2021-01-04 19:48:40 +01:00
Daniel Eklöf
55ecf29a36
selection: wip: update selection row-wise when initial selection was by row 2021-01-04 19:48:40 +01:00
Daniel Eklöf
30de262d29
selection: wip: update selection word-wise when initial selection was by word 2021-01-04 19:48:26 +01:00
Daniel Eklöf
482690e5fb
render: draw combining characters on top of colored bitmap glyphs (emoji) 2021-01-04 18:32:55 +01:00
Daniel Eklöf
21c1d9739b
input: don’t try to close an invalid FD 2021-01-04 18:32:22 +01:00
Daniel Eklöf
9d8ca321d6
input: don’t assert when receiving a button release without a press event 2021-01-04 18:32:00 +01:00
Daniel Eklöf
b4d7a60864
Merge branch 'hex2nibble' 2021-01-04 08:32:31 +01:00
Daniel Eklöf
07f000fa45
Merge branch 'blank-before-trailing-comment'
Closes #270
2021-01-04 08:30:40 +01:00
Craig Barnes
b9a7cbf21d uri: rename nibbletohex() function to hex2nibble()
It converts a hex digit to a nibble, not the other way around.
2021-01-04 05:31:19 +00:00
Craig Barnes
d30414b3a3 uri: use nibble2hex() instead of isxdigit(3) to check valid hex digits 2021-01-04 05:25:14 +00:00
Peter Colberg
49ec4c79a7 Add myself to Contributors 2021-01-03 15:49:24 -05:00
Peter Colberg
afc343d528 Require trailing comment to be preceded by a space or tab
Fixes `word-delimiters` option to not ignore `#` and subsequent characters.

Closes #270
2021-01-03 14:08:25 -05:00
Daniel Eklöf
e2b3ef63b9
Merge branch 'macros' 2021-01-03 12:19:11 +01:00
Craig Barnes
39b2e46e72 Use wrappers from macros.h instead of bare GCC attributes/pragmas 2021-01-03 08:56:47 +00:00
Craig Barnes
2559a9711c macros: add wrappers for more GCC/Clang attributes/pragmas/builtins 2021-01-03 08:47:12 +00:00
Daniel Eklöf
5cc2f94668
Merge branch 'box-drawing'
Closes #198
2021-01-03 00:08:08 +01:00
Daniel Eklöf
ae6d8e0c7f
render: mark cell overflowed into as dirty
When tweak.allow-overflowing-double-width-glyphs=yes, then certain
glyphs are allowed to overflow into the neighbouring cell.

However, if the cell “owning” the double-width glyph is erased (_only_
that cell), then the cell overflowed into is not redrawn, causing
part of the double-width glyph to remain on screen.

To avoid checking for these glyphs when printing to the terminal (i.e
at parse time), simply mark both cells as dirty when we render the
overflowing glyph.

Yes, this means that the cells will always be re-rendered. We count on
them only making up a small portion of the screen.
2021-01-02 22:31:07 +01:00
Daniel Eklöf
0861e8d377
box-drawing: drop ‘pragma GCC optimize(“Os”)’
“The optimize attribute should be used for debugging purposes
  only. It is not suitable in production code.”

Luckily, it seems it really isn’t needed anymore; with all the other
size optimizations that has been done since this was introduced, there
is no longer any difference with or without this pragma.
2021-01-02 17:47:47 +01:00
Daniel Eklöf
c7a611fdf3
box-drawing: codespell: assymetrical -> asymmetrical 2021-01-02 12:35:53 +01:00
Daniel Eklöf
e353edaf41
box-drawing: add macros for {h,v}line_middle_mixed()
Mixed here refers to mixed thickness - the lines thickness doesn’t
match the thickness of an abstract, orthogonal line going through the
middle of the cell.
2021-01-02 12:28:03 +01:00
Daniel Eklöf
5a5134e9bd
box-drawing: LIGHT ARC: simpler way to adjust for asymmetrical arc when mirroring
When mirroring an arc, we need to adjust the mirrored position if the
arc’s position in the cell is asymmetrical. This happens when *either*
the line is odd sized, *or* the cell is. But not when both are.

Thus, we can simply do a ‘thickness % 2 ^ width % 2’ when adjusting
the position.

Describe this in a comment.
2021-01-02 12:09:00 +01:00
Daniel Eklöf
66497cfd4d
box-drawing: LIGHT ARC: use min/max instead of checking range inside loop 2021-01-02 12:08:32 +01:00
Daniel Eklöf
d8e40cf5d4
box-drawing: LIGHT ARC: fix alignment of arcs when thickness is > 1px 2021-01-02 02:26:12 +01:00
Daniel Eklöf
87dcdc2b3b
box-drawing: LIGHT ARC: test using a circle equation instead of a bezier curve 2021-01-02 00:52:02 +01:00
Daniel Eklöf
128883fa05
box-drawing: guard GCC pragma with #if defined(__GNUC__) 2021-01-01 23:35:55 +01:00
Daniel Eklöf
a20c6bd667
box-drawing: do not inline any of the utility functions 2021-01-01 22:29:26 +01:00
Daniel Eklöf
7d0fb3cccd
macros: add NOINLINE (__attribute__((noinline))) 2021-01-01 22:29:12 +01:00
Daniel Eklöf
fc79dbb5a3
box-drawing: dedicated functions to draw a full horizontal/vertical line 2021-01-01 22:24:52 +01:00
Daniel Eklöf
068f93d226
box-drawing: convert {h,v}line_middle_{left,right,up,down}() macros to functions
This greatly reduces the size of the foot binary
2021-01-01 22:12:40 +01:00
Daniel Eklöf
d1993f1f91
box-drawing: sextants: convert sextant_*() macros to functions
While this doesn’t really reduce foot’s size, it is cleaner
2021-01-01 22:01:09 +01:00
Daniel Eklöf
f7669c1e24
box-drawing: quadrants: convert quad_*() macros to functions
This reduces the size of the foot binary by ~4K; all the quad
macros called ceil() and floor() twice per macro, which caused many
float -> int -> float conversions in the expanded code.

By using functions instead, there’s no expansion - the conversion only
happens in one (well, four) places.
2021-01-01 21:56:53 +01:00
Daniel Eklöf
c75192b4f8
box-drawing: reduce number of function arguments
We were using so many function arguments that a lot of the emitted
code was just stack push and pops to pass around arguments.

Bundle the buffer data, width, height, stride, and current DPI, into a
single ‘buf’ argument. This greatly reduces the number of arguments to
all functions.
2021-01-01 21:47:05 +01:00
Daniel Eklöf
25f21d4202
box-drawing: force minsize optimization 2021-01-01 21:28:12 +01:00
Daniel Eklöf
11d4e9ee53
box-drawing: disable debug output 2021-01-01 21:27:53 +01:00
Daniel Eklöf
71d187119f
changelog: box drawing characters are rendered by foot 2021-01-01 21:09:39 +01:00
Daniel Eklöf
81ac95995a
box-drawing: LIGHT DIAGONALs
* U+2571
* U+2572
* U+2573
2021-01-01 21:09:39 +01:00
Daniel Eklöf
ca423bcb01
box-drawing: silence variable-may-not-be-initialized warnings 2021-01-01 21:09:38 +01:00
Daniel Eklöf
ebb5e9eeae
box-drawing: LIGHT/HEAVY DOUBLE/TRIPLE/QUADRUPLE VERTICAL
Also combine the HORIZONTAL versions into a single draw function.

* U+2506
* U+2507
* U+250A
* U+250B
* U+254E
* U+254F
2021-01-01 21:09:38 +01:00
Daniel Eklöf
34360fbb7d
box-drawing: LIGHT/HEAVY DOUBLE/TRIPLE/QUADRUPLE HORIZONTAL
*U+2504
*U+2505
*U+2508
*U+2509
*U+254C
*U+254D
2021-01-01 21:09:38 +01:00
Daniel Eklöf
848bd27dd5
box-drawing: LIGHT ARC: improve symmetry when cell width is even 2021-01-01 21:09:38 +01:00
Daniel Eklöf
167078c076
box-drawing: LIGHT ARC: no need to do floating point since we’re truncating 2021-01-01 21:09:38 +01:00
Daniel Eklöf
56e947bb44
box-drawing: LIGHT ARC: pixel-perfect
At least in odd-sized cells, with a thickness of 1 pixel.
2021-01-01 21:09:38 +01:00