meta: replace bluelib with fx
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "buffer.h"
|
||||
#include "cursor.h"
|
||||
#include "hl-range.h"
|
||||
#include <blue/term/tty.h>
|
||||
#include <fx/term/tty.h>
|
||||
|
||||
/* prints the provided string to the terminal, applying any relevant highlight ranges.
|
||||
* this function prints all characters in `s` until it encounters a null char (\0) or
|
||||
@@ -16,12 +16,12 @@
|
||||
*/
|
||||
void print_text(struct line_ed *ed, size_t x, size_t y, const char *s)
|
||||
{
|
||||
b_tty *tty = ed->l_tty;
|
||||
fx_tty *tty = ed->l_tty;
|
||||
struct hl_range *cur_range = get_hl_range(ed, x, y);
|
||||
|
||||
for (size_t i = 0; s[i] != '\n' && s[i] != '\0'; i++) {
|
||||
if (!cur_range) {
|
||||
b_tty_reset_vmode(tty);
|
||||
fx_tty_reset_vmode(tty);
|
||||
fputc(s[i], stdout);
|
||||
continue;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ void put_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
if (ed->l_flags & LINE_ED_FULL_REPRINT) {
|
||||
if (start_x) {
|
||||
//fprintf(stdout, "\033[%uD", start_x);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -(long long)start_x);
|
||||
fx_tty_move_cursor_x(ed->l_tty, FX_TTY_POS_CURSOR, -(long long)start_x);
|
||||
}
|
||||
|
||||
start_x = 0;
|
||||
@@ -119,7 +119,7 @@ void put_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
* so that the physical cursor will be placed AFTER the character that
|
||||
* was just inserted. */
|
||||
cursor_rdelta--;
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -cursor_rdelta);
|
||||
fx_tty_move_cursor_x(ed->l_tty, FX_TTY_POS_CURSOR, -cursor_rdelta);
|
||||
|
||||
#if 0
|
||||
for (unsigned int i = 0; i < cursor_rdelta; i++) {
|
||||
@@ -162,21 +162,21 @@ void backspace_nl_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
* has just been moved up. from here, clear this line and the rest
|
||||
* from the screen. */
|
||||
//fputs("\033[J", stdout);
|
||||
b_tty_clear(ed->l_tty, B_TTY_CLEAR_SCREEN | B_TTY_CLEAR_FROM_CURSOR);
|
||||
fx_tty_clear(ed->l_tty, FX_TTY_CLEAR_SCREEN | FX_TTY_CLEAR_FROM_CURSOR);
|
||||
|
||||
if (ed->l_flags & LINE_ED_FULL_REPRINT) {
|
||||
/* next, move the physical cursor up and to the beginning of the previous line */
|
||||
size_t tmp_x;
|
||||
line_ed_coords_to_physical_coords(ed, 0, ed->l_cursor_y, &tmp_x, NULL);
|
||||
b_tty_move_cursor_y(ed->l_tty, B_TTY_POS_CURSOR, -1);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_START, tmp_x);
|
||||
fx_tty_move_cursor_y(ed->l_tty, FX_TTY_POS_CURSOR, -1);
|
||||
fx_tty_move_cursor_x(ed->l_tty, FX_TTY_POS_START, tmp_x);
|
||||
//fprintf(stdout, "\033[A\033[%uG", tmp_x + 1);
|
||||
start_x = 0;
|
||||
} else {
|
||||
/* next, move the physical cursor up and to the end of the previous line */
|
||||
//fprintf(stdout, "\033[A\033[%uG", new_x);
|
||||
b_tty_move_cursor_y(ed->l_tty, B_TTY_POS_CURSOR, -1);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_START, new_x);
|
||||
fx_tty_move_cursor_y(ed->l_tty, FX_TTY_POS_CURSOR, -1);
|
||||
fx_tty_move_cursor_x(ed->l_tty, FX_TTY_POS_START, new_x);
|
||||
}
|
||||
|
||||
/* now reprint all of the buffer lines, starting with the first of the
|
||||
@@ -202,11 +202,11 @@ void backspace_nl_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
* were concatenated. */
|
||||
if (ydiff) {
|
||||
//fprintf(stdout, "\033[%uA", ydiff);
|
||||
b_tty_move_cursor_y(ed->l_tty, B_TTY_POS_CURSOR, ydiff);
|
||||
fx_tty_move_cursor_y(ed->l_tty, FX_TTY_POS_CURSOR, ydiff);
|
||||
}
|
||||
|
||||
//fprintf(stdout, "\033[%uG", new_x);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_START, new_x);
|
||||
fx_tty_move_cursor_x(ed->l_tty, FX_TTY_POS_START, new_x);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
@@ -232,14 +232,14 @@ void backspace_simple_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
if (ed->l_flags & LINE_ED_FULL_REPRINT) {
|
||||
if (start_x) {
|
||||
//fprintf(stdout, "\033[%uD", start_x);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -(long long)start_x);
|
||||
fx_tty_move_cursor_x(ed->l_tty, FX_TTY_POS_CURSOR, -(long long)start_x);
|
||||
}
|
||||
|
||||
start_x = 0;
|
||||
}
|
||||
|
||||
//fputc('\010', stdout);
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -1);
|
||||
fx_tty_move_cursor_x(ed->l_tty, FX_TTY_POS_CURSOR, -1);
|
||||
print_text(ed, start_x, ed->l_cursor_y, line_buf + start_x);
|
||||
fputc(' ', stdout);
|
||||
|
||||
@@ -248,7 +248,7 @@ void backspace_simple_refresh(struct line_ed *ed, struct refresh_state *state)
|
||||
* the fact that backspace was just pressed) */
|
||||
cursor_rdelta++;
|
||||
|
||||
b_tty_move_cursor_x(ed->l_tty, B_TTY_POS_CURSOR, -cursor_rdelta);
|
||||
fx_tty_move_cursor_x(ed->l_tty, FX_TTY_POS_CURSOR, -cursor_rdelta);
|
||||
|
||||
#if 0
|
||||
for (unsigned int i = 0; i < cursor_rdelta; i++) {
|
||||
|
||||
Reference in New Issue
Block a user