diff --git a/Frontend Angular 4/src/app/layout/matefun/codemirror/matefun-mode-EN.js b/Frontend Angular 4/src/app/layout/matefun/codemirror/matefun-mode-EN.js index ca710ae30b9cb22dab6e0d822ad5d6514c320a21..eed8c31296917620b2eb0f568b014b4526051060 100644 --- a/Frontend Angular 4/src/app/layout/matefun/codemirror/matefun-mode-EN.js +++ b/Frontend Angular 4/src/app/layout/matefun/codemirror/matefun-mode-EN.js @@ -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); diff --git a/Frontend Angular 4/src/app/layout/matefun/matefun.component.html b/Frontend Angular 4/src/app/layout/matefun/matefun.component.html index 55ba8c9d1abe04c49298b71a12bf580c3ad8eb47..c1bcee035f4df31b7eb8399e31da8bf69cf424a9 100755 --- a/Frontend Angular 4/src/app/layout/matefun/matefun.component.html +++ b/Frontend Angular 4/src/app/layout/matefun/matefun.component.html @@ -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> diff --git a/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts b/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts index 2fc79a02f1c1f109f765c98025d21866b31c77b0..b844381c1876cb3ec54f60b0f5f435d69f0ddec7 100755 --- a/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts +++ b/Frontend Angular 4/src/app/layout/matefun/matefun.component.ts @@ -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{