summaryrefslogtreecommitdiff
path: root/src/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index 12daa72..01218cc 100644
--- a/src/core.c
+++ b/src/core.c
@@ -14,7 +14,19 @@
static uint16_t cluster_presentation(const uint32_t *cps, int len)
{
+ if (len <= 1)
+ return 0;
bool pictographic = unicode_extended_pictographic(cps[0]);
+ if (len == 2) {
+ uint32_t c1 = cps[1];
+ if (c1 == 0xFE0F) return CELL_EMOJI;
+ if (c1 == 0xFE0E) return CELL_TEXT;
+ if (c1 == 0x20E3 || grapheme_regional_indicator(c1) ||
+ (pictographic && (c1 == 0x200D || grapheme_emoji_modifier(c1) ||
+ (c1 >= 0xE0020 && c1 <= 0xE007F))))
+ return CELL_EMOJI;
+ return 0;
+ }
bool emoji = false;
for (int i = 1; i < len; i++) {
if (cps[i] == 0xFE0F)
@@ -320,6 +332,19 @@ void term_sc_tab(struct term *t, int n)
int dir = n >= 0 ? 1 : -1;
int count = n >= 0 ? n : -n;
if (count > t->cols) count = t->cols;
+ if (!t->custom_tabs) {
+ if (dir > 0) {
+ int next = ((t->cursor_x / 8) + count) * 8;
+ t->cursor_x = next < t->cols ? next : t->cols - 1;
+ } else {
+ int prev = t->cursor_x > 0 ? (((t->cursor_x - 1) / 8 - (count - 1)) * 8) : 0;
+ t->cursor_x = prev > 0 ? prev : 0;
+ }
+ t->pending_wrap = false;
+ struct srow *cur = term_row(t, t->cursor_y);
+ if (cur) cur->version++;
+ return;
+ }
while (count-- > 0) {
int x = t->cursor_x + dir;
while (x > 0 && x < t->cols - 1 && !t->tabs[x])