@@ -188,18 +188,13 @@ return l; } suggest (sWord, nMaxSugg=10) { // returns a array of suggestions for - let sAdd = ""; - if (sWord.includes("-")) { - let nLastHyphenPos = sWord.lastIndexOf("-"); - if (char_player.aExcludedSfx.has(sWord.slice(nLastHyphenPos+1))) { - sAdd = sWord.slice(nLastHyphenPos); - sWord = sWord.slice(0, nLastHyphenPos); - } - } + let sPfx = ""; + let sSfx = ""; + [sPfx, sWord, sSfx] = char_player.cut(sWord); let nMaxDel = Math.floor(sWord.length / 5); let nMaxHardRepl = Math.max(Math.floor((sWord.length - 5) / 4), 1); let aSugg = this._suggest(sWord, nMaxDel, nMaxHardRepl); if (sWord.gl_isTitle()) { aSugg.gl_update(this._suggest(sWord.toLowerCase(), nMaxDel, nMaxHardRepl)); @@ -218,13 +213,13 @@ } let dDistTemp = new Map(); aSugg.forEach((sSugg) => { dDistTemp.set(sSugg, char_player.distanceDamerauLevenshtein(sWord, sSugg)); }); aSugg = aSugg.sort((sA, sB) => { return dDistTemp.get(sA) - dDistTemp.get(sB); }).slice(0, nMaxSugg); dDistTemp.clear(); - if (sAdd) { + if (sSfx || sPfx) { // we add what we removed - return aSugg.map( (sSugg) => { return sSugg + sAdd } ); + return aSugg.map( (sSugg) => { return sPfx + sSugg + sSfx } ); } return aSugg; } _suggest (sRemain, nMaxDel=0, nMaxHardRepl=0, nDeep=0, iAddr=0, sNewWord="", bAvoidLoop=false) {