chore: rename candidate length vars

This commit is contained in:
CismonX 2023-12-01 20:10:15 +08:00
parent da1b6e3c69
commit 7dc5ad1c5c
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
7 changed files with 12 additions and 12 deletions

View File

@ -54,7 +54,7 @@ type is defined as:
.EX
typedef char *(arif_cand_disp_func) (
char const *text,
int len,
int text_len,
char const *comment,
int comment_len,
int idx,

View File

@ -38,7 +38,7 @@ type is defined as:
.EX
struct arif_cand {
char const *text;
int len;
int text_len;
int replace_start;
int replace_len;
char const *transform;

View File

@ -240,7 +240,7 @@ arif_rime_query (
*cand = (struct arif_cand) {
.text = prefix,
.len = prefix_len,
.text_len = prefix_len,
.replace_len = len,
};
idx = 1;
@ -301,7 +301,7 @@ copy_candidate (
}
*dest = (struct arif_cand) {
.text = buf,
.len = text_len,
.text_len = text_len,
.replace_start = prefix_len + composition->sel_start,
.replace_len = composition->sel_end - composition->sel_start,
.transform = buf + text_len,

View File

@ -32,7 +32,7 @@ struct arif_ctx;
typedef char *(arif_cand_disp_func) (
char const *text,
int len,
int text_len,
char const *comment,
int comment_len,
int idx,
@ -65,7 +65,7 @@ typedef int (arif_engine_query_func) (
struct arif_cand {
char const *text;
int len;
int text_len;
int replace_start;
int replace_len;
char const *transform;

View File

@ -127,12 +127,12 @@ copy_candidate (
arif_cand_disp_func *disp_cand
) {
int display_len;
char *display = disp_cand(src->text, src->len,
char *display = disp_cand(src->text, src->text_len,
src->display, src->display_len, idx + 1, &display_len);
*dest = (struct arif_cand) {
.text = src->text,
.len = src->len,
.text_len = src->text_len,
.replace_start = src->replace_start,
.replace_len = src->replace_len,
.transform = src->transform,

View File

@ -83,7 +83,7 @@ arif_rl_complete(
line_len = end;
}
int len = line_len - cand->replace_len + cand->len + skip;
int len = line_len - cand->replace_len + cand->text_len + skip;
char *match = malloc(sizeof(char) * (len + 1));
assert(match != NULL);
@ -94,9 +94,9 @@ arif_rl_complete(
memcpy(match + offset, line, cand->replace_start);
offset += cand->replace_start;
memcpy(match + offset, cand->text, cand->len);
memcpy(match + offset, cand->text, cand->text_len);
offset += cand->len;
offset += cand->text_len;
memcpy(match + offset,
line + cand->replace_start + cand->replace_len,
len - offset);

View File

@ -181,7 +181,7 @@ generate_candidate (
*cand = (struct arif_cand) {
.text = text,
.len = len,
.text_len = len,
.replace_len = len,
};
}