minitel-standalone
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -7,2 +7,3 @@ "use strict"; | ||
const richchargrid_js_1 = require("../richchargrid.js"); | ||
const utils_js_1 = require("../utils.js"); | ||
class Input extends minitelobject_js_1.MinitelObject { | ||
@@ -76,11 +77,12 @@ constructor(children, attributes, minitel) { | ||
const lines = this.value.split('\n'); | ||
let cumulPosition = lines.filter((_, i) => i < this.cursorActuallyAt[0] - 1).reduce((p, v) => p + v.length + 1, 0); | ||
let cumulPosition = lines.filter((_, i) => i < this.cursorActuallyAt[0]).reduce((p, v) => p + v.length + 1, 0); | ||
cumulPosition += this.cursorActuallyAt[1]; | ||
const chars = this.value.split(''); | ||
chars.splice(cumulPosition, 0, key === '\x0d' ? '\n' : key); | ||
this.value = chars.join(''); | ||
if (key === '\x0d') { | ||
this.lastFocusCursorX = this.cursorActuallyAt[1] = 0; | ||
this.lastFocusCursorX = 0; | ||
this.cursorActuallyAt[1] = 0; | ||
this.cursorActuallyAt[0] += 1; | ||
} | ||
this.value = chars.join(''); | ||
if (this.attributes.onChange) | ||
@@ -120,3 +122,3 @@ this.attributes.onChange(this); | ||
for (let line of lines) { | ||
result.mergeY(richchargrid_js_1.RichCharGrid.fromLine(line, attributes).setWidth(concreteWidth, attributes.textAlign, fillChar)); | ||
result.mergeY(richchargrid_js_1.RichCharGrid.fromLine(line, attributes).setWidth(concreteWidth, utils_js_1.alignInvrt[attributes.textAlign], fillChar)); | ||
} | ||
@@ -123,0 +125,0 @@ if (attributes.height != null) { |
{ | ||
"name": "minitel-standalone", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A standalone package for minitel components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,2 +5,3 @@ import { Focusable, FocusableAttributes } from '../abstract/focusable.js'; | ||
import { RichCharGrid } from '../richchargrid.js'; | ||
import { alignInvrt } from '../utils.js'; | ||
import type { Minitel } from './minitel.js'; | ||
@@ -109,11 +110,12 @@ | ||
let cumulPosition = lines.filter((_, i) => i < this.cursorActuallyAt[0] - 1).reduce((p, v) => p + v.length + 1, 0); | ||
let cumulPosition = lines.filter((_, i) => i < this.cursorActuallyAt[0]).reduce((p, v) => p + v.length + 1, 0); | ||
cumulPosition += this.cursorActuallyAt[1]; | ||
const chars = this.value.split(''); | ||
chars.splice(cumulPosition, 0, key === '\x0d' ? '\n' : key); | ||
this.value = chars.join(''); | ||
if (key === '\x0d') { | ||
this.lastFocusCursorX = this.cursorActuallyAt[1] = 0; | ||
this.lastFocusCursorX = 0; | ||
this.cursorActuallyAt[1] = 0; | ||
this.cursorActuallyAt[0] += 1; | ||
} | ||
this.value = chars.join(''); | ||
@@ -155,3 +157,3 @@ if (this.attributes.onChange) this.attributes.onChange(this); | ||
for (let line of lines) { | ||
result.mergeY(RichCharGrid.fromLine(line, attributes).setWidth(concreteWidth, attributes.textAlign, fillChar)); | ||
result.mergeY(RichCharGrid.fromLine(line, attributes).setWidth(concreteWidth, alignInvrt[attributes.textAlign], fillChar)); | ||
} | ||
@@ -158,0 +160,0 @@ if (attributes.height != null) { |
178683
3825