mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +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)
|
||||
{
|
||||
int i = 0;
|
||||
while (c > unicode_blocks[i].end && i < no_blocks)
|
||||
++i;
|
||||
if (!unicode_blocks[i].name.isEmpty())
|
||||
return unicode_blocks[i].name;
|
||||
return QString();
|
||||
// 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;
|
||||
while (c > unicode_blocks[i].end && i < no_blocks)
|
||||
++i;
|
||||
if (unicode_blocks[i].name.isEmpty())
|
||||
return QString();
|
||||
lastBlock = i;
|
||||
}
|
||||
return unicode_blocks[lastBlock].name;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user