mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 16:42:30 +02:00
Merge pull request #930 from ailin-nemui/fix-928
fix accessing unallocated text when checking entry position
(cherry picked from commit 708ba06dbc)
This commit is contained in:
parent
5216d091c9
commit
2d803ddd66
1 changed files with 2 additions and 2 deletions
|
|
@ -171,7 +171,7 @@ static int pos2scrpos(GUI_ENTRY_REC *entry, int pos)
|
||||||
int i;
|
int i;
|
||||||
int xpos = 0;
|
int xpos = 0;
|
||||||
|
|
||||||
for (i = 0; i < pos; i++) {
|
for (i = 0; i < entry->text_len && i < pos; i++) {
|
||||||
unichar c = entry->text[i];
|
unichar c = entry->text[i];
|
||||||
|
|
||||||
if (term_type == TERM_TYPE_BIG5)
|
if (term_type == TERM_TYPE_BIG5)
|
||||||
|
|
@ -181,7 +181,7 @@ static int pos2scrpos(GUI_ENTRY_REC *entry, int pos)
|
||||||
else
|
else
|
||||||
xpos++;
|
xpos++;
|
||||||
}
|
}
|
||||||
return xpos;
|
return xpos + pos - i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scrpos2pos(GUI_ENTRY_REC *entry, int pos)
|
static int scrpos2pos(GUI_ENTRY_REC *entry, int pos)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue