meta: replace bluelib with fx
This commit is contained in:
@@ -1,42 +1,42 @@
|
||||
#include "line-ed.h"
|
||||
|
||||
#include <blue/ds/array.h>
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/array.h>
|
||||
#include <fx/ds/string.h>
|
||||
|
||||
void alloc_empty_history_entry(struct line_ed *ed)
|
||||
{
|
||||
b_string *str = (b_string *)b_array_at(
|
||||
ed->l_history, b_array_size(ed->l_history) - 1);
|
||||
if (!str || b_string_get_size(str, B_STRLEN_NORMAL) > 0) {
|
||||
str = b_string_create();
|
||||
b_array_append(ed->l_history, (b_object *)str);
|
||||
fx_string *str = (fx_string *)fx_array_at(
|
||||
ed->l_history, fx_array_size(ed->l_history) - 1);
|
||||
if (!str || fx_string_get_size(str, FX_STRLEN_NORMAL) > 0) {
|
||||
str = fx_string_create();
|
||||
fx_array_append(ed->l_history, (fx_object *)str);
|
||||
}
|
||||
|
||||
ed->l_history_pos = b_array_size(ed->l_history) - 1;
|
||||
ed->l_history_pos = fx_array_size(ed->l_history) - 1;
|
||||
}
|
||||
|
||||
void save_buf_to_history(struct line_ed *ed)
|
||||
{
|
||||
b_string *cur = (b_string *)b_array_get(ed->l_history, ed->l_history_pos);
|
||||
b_string_replace_all(cur, ed->l_buf);
|
||||
fx_string *cur = (fx_string *)fx_array_get(ed->l_history, ed->l_history_pos);
|
||||
fx_string_replace_all(cur, ed->l_buf);
|
||||
}
|
||||
|
||||
void append_buf_to_history(struct line_ed *ed)
|
||||
{
|
||||
b_string *cur = (b_string *)b_array_get(ed->l_history, ed->l_history_pos);
|
||||
fx_string *cur = (fx_string *)fx_array_get(ed->l_history, ed->l_history_pos);
|
||||
char s[] = {'\n', 0};
|
||||
b_string_append_cstr(cur, s);
|
||||
b_string_append_cstr(cur, ed->l_buf);
|
||||
fx_string_append_cstr(cur, s);
|
||||
fx_string_append_cstr(cur, ed->l_buf);
|
||||
}
|
||||
|
||||
void load_buf_from_history(struct line_ed *ed)
|
||||
{
|
||||
b_string *cur = (b_string *)b_array_at(ed->l_history, ed->l_history_pos);
|
||||
fx_string *cur = (fx_string *)fx_array_at(ed->l_history, ed->l_history_pos);
|
||||
size_t len
|
||||
= MIN((size_t)(ed->l_buf_end - ed->l_buf - 1),
|
||||
b_string_get_size(cur, B_STRLEN_NORMAL));
|
||||
fx_string_get_size(cur, FX_STRLEN_NORMAL));
|
||||
|
||||
memcpy(ed->l_buf, b_string_ptr(cur), len);
|
||||
memcpy(ed->l_buf, fx_string_ptr(cur), len);
|
||||
ed->l_buf[len] = '\0';
|
||||
|
||||
unsigned int x = 0, y = 0;
|
||||
@@ -57,11 +57,11 @@ void load_buf_from_history(struct line_ed *ed)
|
||||
|
||||
const char *last_history_line(struct line_ed *ed)
|
||||
{
|
||||
size_t nlines = b_array_size(ed->l_history);
|
||||
size_t nlines = fx_array_size(ed->l_history);
|
||||
if (nlines < 2) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
b_string *last = (b_string *)b_array_at(ed->l_history, nlines - 2);
|
||||
return b_string_ptr(last);
|
||||
fx_string *last = (fx_string *)fx_array_at(ed->l_history, nlines - 2);
|
||||
return fx_string_ptr(last);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user