mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-12 03:29:10 +02:00
Same for cell_as_utf8_for_fallback
This commit is contained in:
@@ -422,7 +422,7 @@ static struct { char *buf; size_t capacity; } ft_buffer;
|
||||
static CFStringRef
|
||||
lc_as_fallback(const ListOfChars *lc) {
|
||||
ensure_space_for((&ft_buffer), buf, ft_buffer.buf[0], lc->count * 4 + 128, capacity, 256, false);
|
||||
cell_as_utf8_for_fallback(lc, ft_buffer.buf);
|
||||
cell_as_utf8_for_fallback(lc, ft_buffer.buf, ft_buffer.capacity);
|
||||
return CFStringCreateWithCString(NULL, ft_buffer.buf, kCFStringEncodingUTF8);
|
||||
}
|
||||
|
||||
|
||||
@@ -414,13 +414,13 @@ cell_as_unicode_for_fallback(const ListOfChars *lc, Py_UCS4 *buf, size_t sz) {
|
||||
}
|
||||
|
||||
size_t
|
||||
cell_as_utf8_for_fallback(const ListOfChars *lc, char *buf) {
|
||||
cell_as_utf8_for_fallback(const ListOfChars *lc, char *buf, size_t sz) {
|
||||
char_type ch = lc->chars[0] ? lc->chars[0] : ' ';
|
||||
bool include_cc = true;
|
||||
if (ch == '\t') { ch = ' '; include_cc = false; }
|
||||
size_t n = encode_utf8(ch, buf);
|
||||
if (include_cc) {
|
||||
for (unsigned i = 1; i < lc->count; i++) {
|
||||
for (unsigned i = 1; i < lc->count && sz > n + 4; i++) {
|
||||
char_type ch = lc->chars[i];
|
||||
if (ch != VS15 && ch != VS16) n += encode_utf8(ch, buf + n);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ index_type prev_char_pos(const Line *self, index_type x, index_type num);
|
||||
bool line_as_ansi(Line *self, ANSILineState *s, index_type start_at, index_type stop_before, char_type prefix_char, bool skip_multiline_non_zero_lines) __attribute__((nonnull));
|
||||
unsigned int line_length(Line *self);
|
||||
size_t cell_as_unicode_for_fallback(const ListOfChars *lc, Py_UCS4 *buf, size_t sz);
|
||||
size_t cell_as_utf8_for_fallback(const ListOfChars *lc, char *buf);
|
||||
size_t cell_as_utf8_for_fallback(const ListOfChars *lc, char *buf, size_t sz);
|
||||
bool unicode_in_range(const Line *self, const index_type start, const index_type limit, const bool include_cc, const bool add_trailing_newline, const bool skip_zero_cells, bool skip_multiline_non_zero_lines, ANSIBuf*);
|
||||
PyObject* line_as_unicode(Line *, bool, ANSIBuf*);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user