fix(hp48): render edited stack lines while editing
Use the input value for the first line and shift stack lookups down for subsequent lines during edit mode. Also route Enter through execute() so editing state is handled consistently before re-rendering.
This commit is contained in:
1 parent
236df5db14
commit
b6ca7d6b75
1 file changed
+6
-6
@@ -287,8 +287,11 @@
|
||||
}
|
||||
|
||||
function getLineValue(line) {
|
||||
if (line === 0 && calc.isEditing) {
|
||||
return calc.inputValue;
|
||||
if (calc.isEditing) {
|
||||
if (line === 0) {
|
||||
return calc.inputValue;
|
||||
}
|
||||
return calc.stack[line - 1];
|
||||
}
|
||||
return calc.stack[line];
|
||||
}
|
||||
@@ -383,10 +386,7 @@
|
||||
try {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
if (calc.isEditing) {
|
||||
calc.command('enter');
|
||||
}
|
||||
render();
|
||||
execute('enter');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user