Skip to content

Commit

Permalink
Increments autocomplete offset when spacebar is NOT pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
KrinklesMontgomery authored and slugalisk committed Jul 8, 2020
1 parent 4908072 commit 8e32df0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion assets/chat/js/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,16 @@ class ChatAutoComplete {
promoteIfSelected(this);
const str = this.input.val().toString();

const offset = this.input[0].selectionStart + 1;
let offset = this.input[0].selectionStart;

const pre = str.substring(0, offset);

const post = str.substring(offset);

if (keycode !== KEYCODES.SPACE) {
offset++;
}

const criteria = buildSearchCriteria(pre + char + post, offset);
this.search(criteria);
keypressed = true;
Expand Down

0 comments on commit 8e32df0

Please sign in to comment.