Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Replace percent-encoded characters in URL Code Hint List with regular characters #5677

Closed
wants to merge 10 commits into from
14 changes: 11 additions & 3 deletions src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,18 @@ define(function (require, exports, module) {
if (indentAuto) {
var currentLength = line.length;
CodeMirror.commands.indentAuto(instance);
// If the amount of whitespace didn't change, insert another tab

// If the amount of whitespace and the cursor position didn't change, we must have
// already been at the correct indentation level as far as CM is concerned, so insert
// another tab.
if (instance.getLine(from.line).length === currentLength) {
insertTab = true;
to.ch = 0;
var newFrom = instance.getCursor(true),
newTo = instance.getCursor(false);
if (newFrom.line === from.line && newFrom.ch === from.ch &&
newTo.line === to.line && newTo.ch === to.ch) {
insertTab = true;
to.ch = 0;
}
}
} else if (instance.somethingSelected() && from.line !== to.line) {
CodeMirror.commands.indentMore(instance);
Expand Down
17 changes: 11 additions & 6 deletions src/extensions/default/UrlCodeHints/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ define(function (require, exports, module) {
// convert to doc relative path
var entryStr = entry.fullPath.replace(docDir, "");

// code hints show the same strings that are inserted into text,
// so strings in list will be encoded. wysiwyg, baby!
unfiltered.push(encodeURI(entryStr));
// code hints show the unencoded string so the
// choices are easier to read. The encoded string
// will still be inserted into the editor.
unfiltered.push(entryStr);
}
});

Expand Down Expand Up @@ -225,7 +226,7 @@ define(function (require, exports, module) {
};

/**
* Determines whether font hints are available in the current editor
* Determines whether url hints are available in the current editor
* context.
*
* @param {Editor} editor
Expand Down Expand Up @@ -356,12 +357,12 @@ define(function (require, exports, module) {
}
}
}

return (query !== null);
};

/**
* Returns a list of availble font hints, if possible, for the current
* Returns a list of available url hints, if possible, for the current
* editor context.
*
* @return {jQuery.Deferred|{
Expand Down Expand Up @@ -504,6 +505,10 @@ define(function (require, exports, module) {
*/
UrlCodeHints.prototype.insertHint = function (completion) {
var mode = this.editor.getModeForSelection();

// Encode the string just prior to inserting the hint into the editor
completion = encodeURI(completion);

if (mode === "html") {
return this.insertHtmlHint(completion);
} else if (mode === "css") {
Expand Down
1 change: 1 addition & 0 deletions src/nls/fr/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ define({
"LOCALE_IT": "Italien",
"LOCALE_JA": "Japonais",
"LOCALE_NB": "Norvégien",
"LOCALE_FA_IR": "Perse",
"LOCALE_PL": "Polonais",
"LOCALE_PT_BR": "Portugais (Brésil)",
"LOCALE_PT_PT": "Portugais",
Expand Down
1 change: 1 addition & 0 deletions src/nls/ja/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ define({
"LOCALE_IT": "イタリア語",
"LOCALE_JA": "日本語",
"LOCALE_NB": "ノルウェー語",
"LOCALE_FA_IR": "ペルシャ語",
"LOCALE_PL": "ポーランド語",
"LOCALE_PT_BR": "ポルトガル語 (ブラジル)",
"LOCALE_PT_PT": "ポルトガル語",
Expand Down