aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core-commands.c30
-rw-r--r--src/interface.h6
-rw-r--r--src/qreg-commands.c4
-rw-r--r--src/search.c8
-rw-r--r--src/spawn.c4
5 files changed, 26 insertions, 26 deletions
diff --git a/src/core-commands.c b/src/core-commands.c
index 176bb17..3686624 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -130,7 +130,7 @@ teco_state_start_dot(teco_machine_main_t *ctx, GError **error)
if (!teco_expressions_eval(FALSE, error))
return;
sptr_t pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0);
- teco_expressions_push(teco_bytes2glyphs(pos));
+ teco_expressions_push(teco_interface_bytes2glyphs(pos));
}
/*$ Z size
@@ -147,7 +147,7 @@ teco_state_start_zed(teco_machine_main_t *ctx, GError **error)
if (!teco_expressions_eval(FALSE, error))
return;
sptr_t pos = teco_interface_ssm(SCI_GETLENGTH, 0, 0);
- teco_expressions_push(teco_bytes2glyphs(pos));
+ teco_expressions_push(teco_interface_bytes2glyphs(pos));
}
/*$ H
@@ -165,7 +165,7 @@ teco_state_start_range(teco_machine_main_t *ctx, GError **error)
return;
teco_expressions_push(0);
sptr_t pos = teco_interface_ssm(SCI_GETLENGTH, 0, 0);
- teco_expressions_push(teco_bytes2glyphs(pos));
+ teco_expressions_push(teco_interface_bytes2glyphs(pos));
}
/*$ \[rs]
@@ -514,7 +514,7 @@ teco_state_start_jump(teco_machine_main_t *ctx, GError **error)
if (!teco_expressions_pop_num_calc(&v, 0, error))
return;
- gssize pos = teco_glyphs2bytes(v);
+ gssize pos = teco_interface_glyphs2bytes(v);
if (pos >= 0) {
if (teco_current_doc_must_undo())
undo__teco_interface_ssm(SCI_GOTOPOS,
@@ -535,7 +535,7 @@ static teco_bool_t
teco_move_chars(teco_int_t n)
{
sptr_t pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0);
- gssize next_pos = teco_glyphs2bytes_relative(pos, n);
+ gssize next_pos = teco_interface_glyphs2bytes_relative(pos, n);
if (next_pos < 0)
return TECO_FAILURE;
@@ -901,7 +901,7 @@ teco_state_start_kill(teco_machine_main_t *ctx, const gchar *cmd, gboolean by_li
teco_int_t len_glyphs;
if (!teco_expressions_pop_num_calc(&len_glyphs, teco_num_sign, error))
return FALSE;
- gssize to = teco_glyphs2bytes_relative(from, len_glyphs);
+ gssize to = teco_interface_glyphs2bytes_relative(from, len_glyphs);
rc = teco_bool(to >= 0);
len = to-from;
}
@@ -911,9 +911,9 @@ teco_state_start_kill(teco_machine_main_t *ctx, const gchar *cmd, gboolean by_li
}
} else {
teco_int_t to_glyphs = teco_expressions_pop_num(0);
- gssize to = teco_glyphs2bytes(to_glyphs);
+ gssize to = teco_interface_glyphs2bytes(to_glyphs);
teco_int_t from_glyphs = teco_expressions_pop_num(0);
- from = teco_glyphs2bytes(from_glyphs);
+ from = teco_interface_glyphs2bytes(from_glyphs);
len = to - from;
rc = teco_bool(len >= 0 && from >= 0 && to >= 0);
}
@@ -1037,7 +1037,7 @@ teco_state_start_get(teco_machine_main_t *ctx, GError **error)
return;
sptr_t pos = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0);
- gssize get_pos = teco_glyphs2bytes_relative(pos, v);
+ gssize get_pos = teco_interface_glyphs2bytes_relative(pos, v);
sptr_t len = teco_interface_ssm(SCI_GETLENGTH, 0, 0);
if (get_pos < 0 || get_pos == len) {
@@ -1787,12 +1787,12 @@ teco_state_control_glyphs2bytes(teco_machine_main_t *ctx, GError **error)
if (!teco_expressions_pop_num_calc(&pos, 0, error))
return;
if (colon_modified) {
- /* teco_bytes2glyphs() does not check addresses */
+ /* teco_interface_bytes2glyphs() does not check addresses */
res = 0 <= pos && pos <= teco_interface_ssm(SCI_GETLENGTH, 0, 0)
- ? teco_bytes2glyphs(pos) : -1;
+ ? teco_interface_bytes2glyphs(pos) : -1;
} else {
/* negative values for invalid indexes are passed down. */
- res = teco_glyphs2bytes(pos);
+ res = teco_interface_glyphs2bytes(pos);
}
}
@@ -2539,7 +2539,7 @@ teco_state_ecommand_encoding(teco_machine_main_t *ctx, GError **error)
teco_int_t dot_glyphs;
if (colon_modified) {
sptr_t dot_bytes = teco_interface_ssm(SCI_GETCURRENTPOS, 0, 0);
- dot_glyphs = teco_bytes2glyphs(dot_bytes);
+ dot_glyphs = teco_interface_bytes2glyphs(dot_bytes);
/*
* Convert buffer to new codepage.
@@ -2587,7 +2587,7 @@ teco_state_ecommand_encoding(teco_machine_main_t *ctx, GError **error)
teco_interface_ssm(SCI_SETCODEPAGE, SC_CP_UTF8, 0);
/*
* UTF-8 documents strictly require the line character index.
- * See teco_glyphs2bytes() and teco_bytes2glyphs().
+ * See teco_view_glyphs2bytes() and teco_view_bytes2glyphs().
*/
g_assert(!(teco_interface_ssm(SCI_GETLINECHARACTERINDEX, 0, 0)
& SC_LINECHARACTERINDEX_UTF32));
@@ -2637,7 +2637,7 @@ teco_state_ecommand_encoding(teco_machine_main_t *ctx, GError **error)
* If the new codepage is UTF-8, the line character index will be
* ready only now.
*/
- teco_interface_ssm(SCI_GOTOPOS, teco_glyphs2bytes(dot_glyphs), 0);
+ teco_interface_ssm(SCI_GOTOPOS, teco_interface_glyphs2bytes(dot_glyphs), 0);
}
/*$ EX exit
diff --git a/src/interface.h b/src/interface.h
index bbefe88..32db6b5 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -161,19 +161,19 @@ teco_interface_get_codepage(void)
}
static inline gssize
-teco_glyphs2bytes(teco_int_t pos)
+teco_interface_glyphs2bytes(teco_int_t pos)
{
return teco_view_glyphs2bytes(teco_interface_current_view, pos);
}
static inline teco_int_t
-teco_bytes2glyphs(gsize pos)
+teco_interface_bytes2glyphs(gsize pos)
{
return teco_view_bytes2glyphs(teco_interface_current_view, pos);
}
static inline gssize
-teco_glyphs2bytes_relative(gsize pos, teco_int_t n)
+teco_interface_glyphs2bytes_relative(gsize pos, teco_int_t n)
{
return teco_view_glyphs2bytes_relative(teco_interface_current_view, pos, n);
}
diff --git a/src/qreg-commands.c b/src/qreg-commands.c
index 0e07944..12bea81 100644
--- a/src/qreg-commands.c
+++ b/src/qreg-commands.c
@@ -750,8 +750,8 @@ teco_state_copytoqreg_got_register(teco_machine_main_t *ctx, teco_qreg_t *qreg,
len *= -1;
}
} else {
- gssize to = teco_glyphs2bytes(teco_expressions_pop_num(0));
- from = teco_glyphs2bytes(teco_expressions_pop_num(0));
+ gssize to = teco_interface_glyphs2bytes(teco_expressions_pop_num(0));
+ from = teco_interface_glyphs2bytes(teco_expressions_pop_num(0));
len = to - from;
if (len < 0 || from < 0 || to < 0) {
diff --git a/src/search.c b/src/search.c
index c1dd542..e146def 100644
--- a/src/search.c
+++ b/src/search.c
@@ -78,12 +78,12 @@ teco_state_search_initial(teco_machine_main_t *ctx, GError **error)
return FALSE;
if (v1 <= v2) {
teco_search_parameters.count = 1;
- teco_search_parameters.from = teco_glyphs2bytes(v1);
- teco_search_parameters.to = teco_glyphs2bytes(v2);
+ teco_search_parameters.from = teco_interface_glyphs2bytes(v1);
+ teco_search_parameters.to = teco_interface_glyphs2bytes(v2);
} else {
teco_search_parameters.count = -1;
- teco_search_parameters.from = teco_glyphs2bytes(v2);
- teco_search_parameters.to = teco_glyphs2bytes(v1);
+ teco_search_parameters.from = teco_interface_glyphs2bytes(v2);
+ teco_search_parameters.to = teco_interface_glyphs2bytes(v1);
}
if (teco_search_parameters.from < 0 ||
diff --git a/src/spawn.c b/src/spawn.c
index 6d3a441..044b8de 100644
--- a/src/spawn.c
+++ b/src/spawn.c
@@ -214,8 +214,8 @@ teco_state_execute_initial(teco_machine_main_t *ctx, GError **error)
if (!teco_expressions_pop_num_calc(&to, 0, error) ||
!teco_expressions_pop_num_calc(&from, 0, error))
return FALSE;
- teco_spawn_ctx.from = teco_glyphs2bytes(from);
- teco_spawn_ctx.to = teco_glyphs2bytes(to);
+ teco_spawn_ctx.from = teco_interface_glyphs2bytes(from);
+ teco_spawn_ctx.to = teco_interface_glyphs2bytes(to);
rc = teco_bool(teco_spawn_ctx.from <= teco_spawn_ctx.to &&
teco_spawn_ctx.from >= 0 && teco_spawn_ctx.to >= 0);
}