Skip to content

Commit

Permalink
Bugfixes in index_obj_completion.
Browse files Browse the repository at this point in the history
- Split object and arguments only at unescaped spaces.

- Keep commas instead of replacing them with spaces.

The latter was an artifact of the toString().replace(/\,/g, " ")
method for concatenating the arguments array, which causes trouble
if any of the arguments contains commas. We now just use join(" ")
instead which preserves the commas.
  • Loading branch information
agraef committed Sep 22, 2024
1 parent 13df168 commit 99b2457
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pd/nw/pdgui.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,9 @@ function search_args(title) {
function index_obj_completion(obj_or_msg, obj_or_msg_text) {
var title, arg;
if (obj_or_msg === "obj") {
let text_array = obj_or_msg_text.split(" ");
let text_array = obj_or_msg_text.split(/(?<!\\) /);
title = text_array[0];
arg = text_array.slice(1, text_array.length).toString().replace(/\,/g, " ");
arg = text_array.slice(1, text_array.length).join(" ");
} else { // the autocomplete feature doesn't work with messages and comments
return;
}
Expand Down

0 comments on commit 99b2457

Please sign in to comment.