mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 723459 - Add an API to SourceEditor to retrieve the character(s) used for indentation. r=msucan
This commit is contained in:
parent
c33b3c8a7a
commit
4dbf499a75
@ -809,6 +809,20 @@ SourceEditor.prototype = {
|
||||
return this._model.getLineDelimiter();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the indentation string used in the document being edited.
|
||||
*
|
||||
* @return string
|
||||
* The indentation string.
|
||||
*/
|
||||
getIndentationString: function SE_getIndentationString()
|
||||
{
|
||||
if (this._expandTab) {
|
||||
return (new Array(this._tabSize + 1)).join(" ");
|
||||
}
|
||||
return "\t";
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the source editor mode to the file type you are editing.
|
||||
*
|
||||
|
@ -324,6 +324,9 @@ function testReturnKey()
|
||||
let lineDelimiter = editor.getLineDelimiter();
|
||||
ok(lineDelimiter, "we have the line delimiter");
|
||||
|
||||
let indentationString = editor.getIndentationString();
|
||||
is(" ", indentationString, "we have an indentation string of 7 spaces");
|
||||
|
||||
is(editor.getText(), " a" + lineDelimiter + " x\n b\n c",
|
||||
"return maintains indentation");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user