Skip to content

Commit

Permalink
code writing improved:
Browse files Browse the repository at this point in the history
- after entering a command the next cell gets focussed
- commands get only written in the first col
  • Loading branch information
timlg07 committed Feb 24, 2019
1 parent 80ebedd commit 595f7e4
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Registermaschine.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,20 @@ class Registermaschine {

handleCmdInput( e ){
if( $storage.focus ){
$storage.focus.value = e.target.getAttribute('id');
$storage.focus.focus();
let i = $storage.speicherZellen.indexOf($storage.focus);

let focus = $storage.focus;
if( i%2 != 0 && i != -1 && i+1 < $storage.speicherZellen.length){
focus = $storage.speicherZellen[++i];
}

focus.value = e.target.getAttribute('id');

if( i == -1 || i+1 >= $storage.speicherZellen.length ){
focus.focus();
} else {
$storage.speicherZellen[++i].focus();
}
}
}

Expand Down

0 comments on commit 595f7e4

Please sign in to comment.