mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-11 09:52:13 +03:00
Mark prompt lines
This commit is contained in:
parent
46b9aca16e
commit
0d4237f802
@ -83,8 +83,12 @@ typedef enum { TILING, SCALED, MIRRORED } BackgroundImageLayout;
|
||||
#define COL_MASK 0xFFFFFFFF
|
||||
#define DECORATION_FG_CODE 58
|
||||
#define CHAR_IS_BLANK(ch) ((ch) == 32 || (ch) == 0)
|
||||
#define CONTINUED_MASK 1
|
||||
#define TEXT_DIRTY_MASK 2
|
||||
enum {
|
||||
CONTINUED_MASK=1,
|
||||
TEXT_DIRTY_MASK=2,
|
||||
PROMPT_START_MASK=4,
|
||||
OUTPUT_START_MASK=8
|
||||
};
|
||||
|
||||
#define FG 1
|
||||
#define BG 2
|
||||
|
@ -56,6 +56,19 @@ linebuf_mark_line_as_not_continued(LineBuf *self, index_type y) {
|
||||
self->line_attrs[y] &= ~CONTINUED_MASK;
|
||||
}
|
||||
|
||||
void
|
||||
linebuf_mark_line_as_prompt_start(LineBuf *self, index_type y) {
|
||||
self->line_attrs[y] |= PROMPT_START_MASK;
|
||||
self->line_attrs[y] &= ~OUTPUT_START_MASK;
|
||||
}
|
||||
|
||||
void
|
||||
linebuf_mark_line_as_output_start(LineBuf *self, index_type y) {
|
||||
self->line_attrs[y] &= ~PROMPT_START_MASK;
|
||||
self->line_attrs[y] |= OUTPUT_START_MASK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static PyObject*
|
||||
clear(LineBuf *self, PyObject *a UNUSED) {
|
||||
|
@ -99,6 +99,8 @@ void linebuf_rewrap(LineBuf *self, LineBuf *other, index_type *, index_type *, H
|
||||
void linebuf_mark_line_dirty(LineBuf *self, index_type y);
|
||||
void linebuf_mark_line_clean(LineBuf *self, index_type y);
|
||||
void linebuf_mark_line_as_not_continued(LineBuf *self, index_type y);
|
||||
void linebuf_mark_line_as_prompt_start(LineBuf *self, index_type y);
|
||||
void linebuf_mark_line_as_output_start(LineBuf *self, index_type y);
|
||||
unsigned int linebuf_char_width_at(LineBuf *self, index_type x, index_type y);
|
||||
void linebuf_refresh_sprite_positions(LineBuf *self);
|
||||
void historybuf_add_line(HistoryBuf *self, const Line *line, ANSIBuf*);
|
||||
|
@ -1712,7 +1712,21 @@ clipboard_control(Screen *self, int code, PyObject *data) {
|
||||
|
||||
void
|
||||
shell_prompt_marking(Screen *self, PyObject *data) {
|
||||
printf("prompt_marking: x=%d y=%d ", self->cursor->x, self->cursor->y); PyObject_Print(data, stdout, 0); printf("\n");
|
||||
if (PyUnicode_READY(data) != 0) { PyErr_Clear(); return; }
|
||||
if (PyUnicode_GET_LENGTH(data) > 0 && self->cursor->y < self->lines) {
|
||||
Py_UCS4 ch = PyUnicode_READ_CHAR(data, 0);
|
||||
switch (ch) {
|
||||
case 'A':
|
||||
linebuf_mark_line_as_prompt_start(self->linebuf, self->cursor->y); break;
|
||||
case 'C':
|
||||
linebuf_mark_line_as_output_start(self->linebuf, self->cursor->y); break;
|
||||
}
|
||||
}
|
||||
if (global_state.debug_rendering) {
|
||||
fprintf(stderr, "prompt_marking: x=%d y=%d op=", self->cursor->x, self->cursor->y);
|
||||
PyObject_Print(data, stderr, 0);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user