Commit 533ebff2 authored by Gabriela Bittencourt's avatar Gabriela Bittencourt
Browse files

Remove message and comment autocompletion

The autocompletion of messages and comments doesn't properly deal with
line breaks in the current implementation. Disable those for now.
parent 81bdfb62
Pipeline #3736 canceled with stage
...@@ -557,14 +557,16 @@ var canvas_events = (function() { ...@@ -557,14 +557,16 @@ var canvas_events = (function() {
if (textbox().innerText === "") { if (textbox().innerText === "") {
pdgui.delete_autocomplete_dd(ac_dropdown()); pdgui.delete_autocomplete_dd(ac_dropdown());
} else { } else {
pdgui.create_autocomplete_dd(document, ac_dropdown(), textbox()); let obj_class = document.getElementById(textbox().getAttribute("tag")+"gobj")
if (ac_dropdown().getAttribute("searched_text") !== textbox().innerText) { .getAttribute("class").toString().split(" ").slice(0,1).toString();
// finding the class from obj: find obj throwout tag of textbox, get obj class and remove from the class the word "selected". if (obj_class === "obj") { // autocomplete only works for objects
// this has to be done because in textbox obj and comment have class: 'obj' pdgui.create_autocomplete_dd(document, ac_dropdown(), textbox());
// and it's import here to differentiate them if (ac_dropdown().getAttribute("searched_text") !== textbox().innerText) {
let obj_class = document.getElementById(textbox().getAttribute("tag")+"gobj") // finding the class from obj: find obj throwout tag of textbox, get obj class and remove from the class the word "selected".
.getAttribute("class").toString().split(" ").slice(0,1).toString(); // this has to be done because in textbox obj and comment have class: 'obj'
pdgui.repopulate_autocomplete_dd(document, ac_dropdown,obj_class,textbox().innerText); // and it's import here to differentiate them
pdgui.repopulate_autocomplete_dd(document, ac_dropdown, obj_class, textbox().innerText);
}
} }
} }
} }
......
...@@ -540,16 +540,12 @@ function search_arg(title, arg) { ...@@ -540,16 +540,12 @@ function search_arg(title, arg) {
function index_obj_completion(obj_or_msg, obj_or_msg_text) { function index_obj_completion(obj_or_msg, obj_or_msg_text) {
var title, arg; var title, arg;
if (obj_or_msg === "msg") { if (obj_or_msg === "obj") {
title = "message";
arg = obj_or_msg_text;
} else if (obj_or_msg === "comment") {
title = "text";
arg = obj_or_msg_text;
} else 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]; title = text_array[0];
arg = text_array.slice(1, text_array.length).toString().replace(/\,/g, " "); arg = text_array.slice(1, text_array.length).toString().replace(/\,/g, " ");
} else { // the autocomplete feature doesn't work with messages and comments
return;
} }
var obj_ref, obj_freq = 1, args = [], arg_ref = 0, arg_freq = 1, obj_found = false; var obj_ref, obj_freq = 1, args = [], arg_ref = 0, arg_freq = 1, obj_found = false;
let obj_result = obj_exact_match(title); let obj_result = obj_exact_match(title);
...@@ -612,8 +608,6 @@ function update_autocomplete_dd_arrowup(ac_dropdown) { ...@@ -612,8 +608,6 @@ function update_autocomplete_dd_arrowup(ac_dropdown) {
} }
} }
// GB TODO: In messages, when the chosen autocomplete is bigger than the message box, it doesn't resize it
// (so the text is written partially outside the message box in gui, what looks strange to the user)
function select_result_autocomplete_dd(textbox, ac_dropdown) { function select_result_autocomplete_dd(textbox, ac_dropdown) {
if (ac_dropdown !== null) { if (ac_dropdown !== null) {
let sel = ac_dropdown.getAttribute("selected_item"); let sel = ac_dropdown.getAttribute("selected_item");
...@@ -635,13 +629,7 @@ function repopulate_autocomplete_dd(doc, ac_dropdown, obj_class, text) { ...@@ -635,13 +629,7 @@ function repopulate_autocomplete_dd(doc, ac_dropdown, obj_class, text) {
title = text_array[0].toString(); title = text_array[0].toString();
arg = text_array.slice(1, text_array.length); arg = text_array.slice(1, text_array.length);
arg = (arg.length !== 0) ? arg.toString().replace(/\,/g, " ") : ""; arg = (arg.length !== 0) ? arg.toString().replace(/\,/g, " ") : "";
} else if (obj_class === "msg"){ } else { // the autocomplete feature doesn't work with messages and comments
title = "message";
arg = text;
} else if (obj_class === "comment") {
title = "text";
arg = text;
} else { // The code should never enter this 'else', but it's covered just in case there is a situation not covered above
return; return;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment