chore: rename candidate length vars
This commit is contained in:
parent
da1b6e3c69
commit
7dc5ad1c5c
|
@ -54,7 +54,7 @@ type is defined as:
|
||||||
.EX
|
.EX
|
||||||
typedef char *(arif_cand_disp_func) (
|
typedef char *(arif_cand_disp_func) (
|
||||||
char const *text,
|
char const *text,
|
||||||
int len,
|
int text_len,
|
||||||
char const *comment,
|
char const *comment,
|
||||||
int comment_len,
|
int comment_len,
|
||||||
int idx,
|
int idx,
|
||||||
|
|
|
@ -38,7 +38,7 @@ type is defined as:
|
||||||
.EX
|
.EX
|
||||||
struct arif_cand {
|
struct arif_cand {
|
||||||
char const *text;
|
char const *text;
|
||||||
int len;
|
int text_len;
|
||||||
int replace_start;
|
int replace_start;
|
||||||
int replace_len;
|
int replace_len;
|
||||||
char const *transform;
|
char const *transform;
|
||||||
|
|
|
@ -240,7 +240,7 @@ arif_rime_query (
|
||||||
|
|
||||||
*cand = (struct arif_cand) {
|
*cand = (struct arif_cand) {
|
||||||
.text = prefix,
|
.text = prefix,
|
||||||
.len = prefix_len,
|
.text_len = prefix_len,
|
||||||
.replace_len = len,
|
.replace_len = len,
|
||||||
};
|
};
|
||||||
idx = 1;
|
idx = 1;
|
||||||
|
@ -301,7 +301,7 @@ copy_candidate (
|
||||||
}
|
}
|
||||||
*dest = (struct arif_cand) {
|
*dest = (struct arif_cand) {
|
||||||
.text = buf,
|
.text = buf,
|
||||||
.len = text_len,
|
.text_len = text_len,
|
||||||
.replace_start = prefix_len + composition->sel_start,
|
.replace_start = prefix_len + composition->sel_start,
|
||||||
.replace_len = composition->sel_end - composition->sel_start,
|
.replace_len = composition->sel_end - composition->sel_start,
|
||||||
.transform = buf + text_len,
|
.transform = buf + text_len,
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct arif_ctx;
|
||||||
|
|
||||||
typedef char *(arif_cand_disp_func) (
|
typedef char *(arif_cand_disp_func) (
|
||||||
char const *text,
|
char const *text,
|
||||||
int len,
|
int text_len,
|
||||||
char const *comment,
|
char const *comment,
|
||||||
int comment_len,
|
int comment_len,
|
||||||
int idx,
|
int idx,
|
||||||
|
@ -65,7 +65,7 @@ typedef int (arif_engine_query_func) (
|
||||||
|
|
||||||
struct arif_cand {
|
struct arif_cand {
|
||||||
char const *text;
|
char const *text;
|
||||||
int len;
|
int text_len;
|
||||||
int replace_start;
|
int replace_start;
|
||||||
int replace_len;
|
int replace_len;
|
||||||
char const *transform;
|
char const *transform;
|
||||||
|
|
|
@ -127,12 +127,12 @@ copy_candidate (
|
||||||
arif_cand_disp_func *disp_cand
|
arif_cand_disp_func *disp_cand
|
||||||
) {
|
) {
|
||||||
int display_len;
|
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);
|
src->display, src->display_len, idx + 1, &display_len);
|
||||||
|
|
||||||
*dest = (struct arif_cand) {
|
*dest = (struct arif_cand) {
|
||||||
.text = src->text,
|
.text = src->text,
|
||||||
.len = src->len,
|
.text_len = src->text_len,
|
||||||
.replace_start = src->replace_start,
|
.replace_start = src->replace_start,
|
||||||
.replace_len = src->replace_len,
|
.replace_len = src->replace_len,
|
||||||
.transform = src->transform,
|
.transform = src->transform,
|
||||||
|
|
|
@ -83,7 +83,7 @@ arif_rl_complete(
|
||||||
line_len = end;
|
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));
|
char *match = malloc(sizeof(char) * (len + 1));
|
||||||
assert(match != NULL);
|
assert(match != NULL);
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ arif_rl_complete(
|
||||||
memcpy(match + offset, line, cand->replace_start);
|
memcpy(match + offset, line, cand->replace_start);
|
||||||
|
|
||||||
offset += 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,
|
memcpy(match + offset,
|
||||||
line + cand->replace_start + cand->replace_len,
|
line + cand->replace_start + cand->replace_len,
|
||||||
len - offset);
|
len - offset);
|
||||||
|
|
|
@ -181,7 +181,7 @@ generate_candidate (
|
||||||
|
|
||||||
*cand = (struct arif_cand) {
|
*cand = (struct arif_cand) {
|
||||||
.text = text,
|
.text = text,
|
||||||
.len = len,
|
.text_len = len,
|
||||||
.replace_len = len,
|
.replace_len = len,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue