mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
choose the shortest pattern
Don't assume it's the last as previous code did
This commit is contained in:
parent
d72142ad40
commit
0c939984f5
2 changed files with 15 additions and 5 deletions
|
@ -27,7 +27,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li>Send language code rather than name when checking for
|
<li>Send language code rather than name when checking for
|
||||||
wordlist upgrades</li>
|
wordlist upgrades</li>
|
||||||
<li>Slightly improve play over Bluetooth</li>
|
<li>Improve play over Bluetooth (slightly)</li>
|
||||||
<li>Include translations in Brazillian Portuguese, Italian,
|
<li>Include translations in Brazillian Portuguese, Italian,
|
||||||
Spanish and Turkish (via Weblate)</li>
|
Spanish and Turkish (via Weblate)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -587,11 +587,12 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
|
|
||||||
PatDesc[] pats = m_browseState.m_pats;
|
PatDesc[] pats = m_browseState.m_pats;
|
||||||
for ( int ii = 0; ii < pats.length && !pending; ++ii ) {
|
for ( int ii = 0; ii < pats.length && !pending; ++ii ) {
|
||||||
|
final PatDesc thisPats = pats[ii];
|
||||||
if ( justFixed == ii ) {
|
if ( justFixed == ii ) {
|
||||||
Assert.assertTrueNR( null != fixedTiles );
|
Assert.assertTrueNR( null != fixedTiles );
|
||||||
pats[ii].tilePat = fixedTiles;
|
thisPats.tilePat = fixedTiles;
|
||||||
} else if ( null == pats[ii].tilePat ) {
|
} else if ( null == thisPats.tilePat ) {
|
||||||
String strPat = pats[ii].strPat;
|
String strPat = thisPats.strPat;
|
||||||
if ( null != strPat && 0 < strPat.length() ) {
|
if ( null != strPat && 0 < strPat.length() ) {
|
||||||
byte[][] choices = XwJNI.dict_strToTiles( m_dict, strPat );
|
byte[][] choices = XwJNI.dict_strToTiles( m_dict, strPat );
|
||||||
if ( null == choices || 0 == choices.length ) {
|
if ( null == choices || 0 == choices.length ) {
|
||||||
|
@ -603,7 +604,16 @@ public class DictBrowseDelegate extends DelegateBase
|
||||||
pending = true;
|
pending = true;
|
||||||
} else if ( 1 == choices.length
|
} else if ( 1 == choices.length
|
||||||
|| !XwJNI.dict_hasDuplicates( m_dict ) ) {
|
|| !XwJNI.dict_hasDuplicates( m_dict ) ) {
|
||||||
pats[ii].tilePat = choices[choices.length - 1];
|
// Pick the shortest option, i.e. when there's a
|
||||||
|
// choice between using one or several tiles to spell
|
||||||
|
// something choose one.
|
||||||
|
thisPats.tilePat = choices[0];
|
||||||
|
for ( int jj = 1; jj < choices.length; ++jj ) {
|
||||||
|
byte[] tilePat = choices[jj];
|
||||||
|
if ( tilePat.length < thisPats.tilePat.length ) {
|
||||||
|
thisPats.tilePat = tilePat;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_browseState.m_delim = DELIM;
|
m_browseState.m_delim = DELIM;
|
||||||
showDialogFragment( DlgID.CHOOSE_TILES, (Object)choices, ii );
|
showDialogFragment( DlgID.CHOOSE_TILES, (Object)choices, ii );
|
||||||
|
|
Loading…
Reference in a new issue