Commit d328472d authored by Franco Pariani's avatar Franco Pariani
Browse files

Show pop-up hints when is writing and also accept dashs and underscores

parent 6ce61821
......@@ -31,13 +31,13 @@
CodeMirror.hint.anyword = function(cm) {
var cur = cm.getCursor(), token = cm.getTokenAt(cur)
var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
if (token.start < cur.ch && /[\w\-\_]/.test(token.string.charAt(cur.ch - token.start - 1))) {
term = token.string.substr(0, cur.ch - token.start)
} else {
term = ""
from = cur
}
var inner = anyWord(cm) || {from: from, to: to, list: []};
var inner = anyWord(cm, { word: /[\w$\-\_]+/ }) || {from: from, to: to, list: []};
var filtered_words = defualt_words.filter(w => w.indexOf(term) === 0);
......
......@@ -68,7 +68,7 @@
</ng-template>
</form>
</div>
<codemirror class="codemirrorPrograma" [(ngModel)]="archivo.contenido" (keyup)="archivoModificado()" [config]="configCodeMirror" [ngStyle]="{'font-size': configCodeMirror.fontSize+'px'}">
<codemirror class="codemirrorPrograma" [(ngModel)]="archivo.contenido" (keyup)="archivoModificado($event)" [config]="configCodeMirror" [ngStyle]="{'font-size': configCodeMirror.fontSize+'px'}">
</codemirror>
</div>
......
......@@ -413,7 +413,9 @@ export class MateFunComponent {
this.copiaContenidoArchivo = '';
}
archivoModificado(){
archivoModificado(event){
if (/^[a-zA-Z\-\_]$/.test(event.key))
this.codemirror.instance.showHint(event);
if(this.copiaNombreArchivo!=this.archivo.nombre || this.copiaContenidoArchivo != this.archivo.contenido){
this.modificado = true;
}else{
......
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