mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-26 19:01:27 +00:00
Simplify API
This commit is contained in:
parent
9cf425006f
commit
e5675e9537
3 changed files with 8 additions and 8 deletions
|
|
@ -691,8 +691,8 @@ draw_codepoint(Screen *self, char_type ch, bool from_input_stream) {
|
|||
}
|
||||
|
||||
void
|
||||
screen_draw(Screen *self, uint32_t och, bool from_input_stream) {
|
||||
draw_codepoint(self, och, from_input_stream);
|
||||
screen_draw(Screen *self, uint32_t och) {
|
||||
draw_codepoint(self, och, true);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1855,7 +1855,7 @@ screen_repeat_character(Screen *self, unsigned int count) {
|
|||
if (self->last_graphic_char) {
|
||||
if (count == 0) count = 1;
|
||||
unsigned int num = MIN(count, CSI_REP_MAX_REPETITIONS);
|
||||
while (num-- > 0) screen_draw(self, self->last_graphic_char, false);
|
||||
while (num-- > 0) draw_codepoint(self, self->last_graphic_char, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3483,7 +3483,7 @@ draw(Screen *self, PyObject *src) {
|
|||
int kind = PyUnicode_KIND(src);
|
||||
void *buf = PyUnicode_DATA(src);
|
||||
Py_ssize_t sz = PyUnicode_GET_LENGTH(src);
|
||||
for (Py_ssize_t i = 0; i < sz; i++) screen_draw(self, PyUnicode_READ(kind, buf, i), true);
|
||||
for (Py_ssize_t i = 0; i < sz; i++) draw_codepoint(self, PyUnicode_READ(kind, buf, i), true);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void screen_cursor_position(Screen*, unsigned int, unsigned int);
|
|||
void screen_cursor_back(Screen *self, unsigned int count/*=1*/, int move_direction/*=-1*/);
|
||||
void screen_erase_in_line(Screen *, unsigned int, bool);
|
||||
void screen_erase_in_display(Screen *, unsigned int, bool);
|
||||
void screen_draw(Screen *screen, uint32_t codepoint, bool);
|
||||
void screen_draw(Screen *screen, uint32_t codepoint);
|
||||
void screen_ensure_bounds(Screen *self, bool use_margins, bool cursor_was_within_margins);
|
||||
void screen_toggle_screen_buffer(Screen *self, bool, bool);
|
||||
void screen_normal_keypad_mode(Screen *self);
|
||||
|
|
|
|||
|
|
@ -222,13 +222,13 @@ draw_byte(PS *self, const uint8_t b) {
|
|||
switch (decode_utf8(&self->utf8.state, &self->utf8.codep, b)) {
|
||||
case UTF8_ACCEPT:
|
||||
REPORT_DRAW(self->utf8.codep);
|
||||
screen_draw(self->screen, self->utf8.codep, true);
|
||||
screen_draw(self->screen, self->utf8.codep);
|
||||
break;
|
||||
case UTF8_REJECT: {
|
||||
bool prev_was_accept = self->utf8.prev == UTF8_ACCEPT;
|
||||
zero_at_ptr(&self->utf8);
|
||||
REPORT_DRAW(0xfffd);
|
||||
screen_draw(self->screen, 0xfffd, true);
|
||||
screen_draw(self->screen, 0xfffd);
|
||||
if (!prev_was_accept) {
|
||||
draw_byte(self, b);
|
||||
return; // so that prev is correct
|
||||
|
|
@ -274,7 +274,7 @@ static void
|
|||
dispatch_printable_ascii(PS *self, const size_t sz) {
|
||||
for (const size_t limit = self->read.pos + sz; self->read.pos < limit; self->read.pos++) {
|
||||
REPORT_DRAW(self->buf[self->read.pos]);
|
||||
screen_draw(self->screen, self->buf[self->read.pos], true);
|
||||
screen_draw(self->screen, self->buf[self->read.pos]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue