readonly editors
This commit is contained in:
Vadim Lopatin 2015-03-23 10:27:58 +03:00
parent 9ccbbb307c
commit f511ba03ff
1 changed files with 6 additions and 6 deletions

View File

@ -1949,7 +1949,7 @@ class EditBox : EditWidgetBase {
dstring currentLine = _content[_caretPos.line]; dstring currentLine = _content[_caretPos.line];
switch (a.id) { switch (a.id) {
case EditorActions.PrependNewLine: case EditorActions.PrependNewLine:
{ if (!readOnly) {
correctCaretPos(); correctCaretPos();
_caretPos.pos = 0; _caretPos.pos = 0;
EditOperation op = new EditOperation(EditAction.Replace, _selectionRange, [""d, ""d]); EditOperation op = new EditOperation(EditAction.Replace, _selectionRange, [""d, ""d]);
@ -1957,7 +1957,7 @@ class EditBox : EditWidgetBase {
} }
return true; return true;
case EditorActions.InsertNewLine: case EditorActions.InsertNewLine:
{ if (!readOnly) {
correctCaretPos(); correctCaretPos();
EditOperation op = new EditOperation(EditAction.Replace, _selectionRange, [""d, ""d]); EditOperation op = new EditOperation(EditAction.Replace, _selectionRange, [""d, ""d]);
_content.performOperation(op, this); _content.performOperation(op, this);
@ -2137,15 +2137,15 @@ class EditBox : EditWidgetBase {
} }
return true; return true;
case EditorActions.ToggleBlockComment: case EditorActions.ToggleBlockComment:
if (_content.syntaxSupport && _content.syntaxSupport.supportsToggleBlockComment && _content.syntaxSupport.canToggleBlockComment(_selectionRange)) if (!readOnly && _content.syntaxSupport && _content.syntaxSupport.supportsToggleBlockComment && _content.syntaxSupport.canToggleBlockComment(_selectionRange))
_content.syntaxSupport.toggleBlockComment(_selectionRange, this); _content.syntaxSupport.toggleBlockComment(_selectionRange, this);
return true; return true;
case EditorActions.ToggleLineComment: case EditorActions.ToggleLineComment:
if (_content.syntaxSupport && _content.syntaxSupport.supportsToggleLineComment && _content.syntaxSupport.canToggleLineComment(_selectionRange)) if (!readOnly && _content.syntaxSupport && _content.syntaxSupport.supportsToggleLineComment && _content.syntaxSupport.canToggleLineComment(_selectionRange))
_content.syntaxSupport.toggleLineComment(_selectionRange, this); _content.syntaxSupport.toggleLineComment(_selectionRange, this);
return true; return true;
case EditorActions.AppendNewLine: case EditorActions.AppendNewLine:
{ if (!readOnly) {
correctCaretPos(); correctCaretPos();
TextPosition p = _content.lineEnd(_caretPos.line); TextPosition p = _content.lineEnd(_caretPos.line);
TextRange r = TextRange(p, p); TextRange r = TextRange(p, p);
@ -2155,7 +2155,7 @@ class EditBox : EditWidgetBase {
} }
return true; return true;
case EditorActions.DeleteLine: case EditorActions.DeleteLine:
{ if (!readOnly) {
correctCaretPos(); correctCaretPos();
EditOperation op = new EditOperation(EditAction.Replace, _content.lineRange(_caretPos.line), [""d]); EditOperation op = new EditOperation(EditAction.Replace, _content.lineRange(_caretPos.line), [""d]);
_content.performOperation(op, this); _content.performOperation(op, this);