@@ -188,10 +188,18 @@ 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 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)); @@ -210,10 +218,14 @@ } 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) { + // we add what we removed + return aSugg.map( (sSugg) => { return sSugg + sAdd } ); + } return aSugg; } _suggest (sRemain, nMaxDel=0, nMaxHardRepl=0, nDeep=0, iAddr=0, sNewWord="", bAvoidLoop=false) { // returns a set of suggestions