From eb4a50ea7a880aa1e188c6199549a00b93b4b960 Mon Sep 17 00:00:00 2001 From: mcmlxxix <> Date: Mon, 8 Aug 2011 21:27:06 +0000 Subject: [PATCH] moved in-line edit code to Form object --- exec/load/form.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/exec/load/form.js b/exec/load/form.js index e836b81b87..06c42077e6 100644 --- a/exec/load/form.js +++ b/exec/load/form.js @@ -53,12 +53,7 @@ function formEdit(obj) break; case '\r': case '\n': - var item = form.items[form.index]; - var coords = form.coords(form.index); - console.gotoxy(coords.x + form.len + 2, coords.y); - console.attributes = BG_LIGHTGRAY + BLACK; - item.value = console.getstr(item.value.toString(),form.max,K_EDIT|K_AUTODEL); - form.drawItem(form.index); + form.edit(); break; case '\b': case '\x11': @@ -99,6 +94,17 @@ function Form(obj) this.box.show_tabs = false; + this.edit = function() { + var item = this.items[this.index]; + var coords = this.coords(this.index); + console.attributes = BG_LIGHTGRAY + BLACK; + console.gotoxy(coords.x + this.len + 2, coords.y); + clearLine(this.max); + console.gotoxy(coords.x + this.len + 2, coords.y); + item.value = console.getstr(item.value.toString(),this.max,K_EDIT|K_AUTODEL); + this.drawItem(this.index); + } + this.draw = function() { this.box.drawView(); -- GitLab