mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-25 17:44:59 +00:00
speed up symbol panel population
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23887 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
94e0c24753
commit
0011f47885
@ -148,12 +148,21 @@ const int no_blocks = sizeof(unicode_blocks) / sizeof(UnicodeBlocks);
|
|||||||
|
|
||||||
QString getBlock(char_type c)
|
QString getBlock(char_type c)
|
||||||
{
|
{
|
||||||
|
// store an educated guess for the next search
|
||||||
|
static int lastBlock = 0;
|
||||||
|
|
||||||
|
if (c < unicode_blocks[lastBlock].start
|
||||||
|
|| c > unicode_blocks[lastBlock].end)
|
||||||
|
{
|
||||||
|
// guess was wrong. do a real search.
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (c > unicode_blocks[i].end && i < no_blocks)
|
while (c > unicode_blocks[i].end && i < no_blocks)
|
||||||
++i;
|
++i;
|
||||||
if (!unicode_blocks[i].name.isEmpty())
|
if (unicode_blocks[i].name.isEmpty())
|
||||||
return unicode_blocks[i].name;
|
|
||||||
return QString();
|
return QString();
|
||||||
|
lastBlock = i;
|
||||||
|
}
|
||||||
|
return unicode_blocks[lastBlock].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user