Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the unability to type dot or plus in some places #282

Merged
merged 1 commit into from
Apr 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions media/editor/editHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,18 @@ export class EditHandler {
public async editAscii(element: HTMLSpanElement, keyPressed: string): Promise<void> {
// We don't want to do anything if the user presses a key such as home etc which will register as greater than 1 char
if (keyPressed.length != 1) return;
// No need to call it edited if it's the same value
if (element.innerText === keyPressed) return;
const offset: number = getElementsOffset(element);
const hexElement = getElementsWithGivenOffset(offset)[0];
const newValueHex = keyPressed.charCodeAt(0).toString(16).toUpperCase();
// No need to call it edited if it's the same value. The comparison is done on hex values because '+' and '.' have additional meaning on ASCII panel
if(hexElement.innerText === newValueHex){
return;
}
// We store all pending edits as hex as ascii isn't always representative due to control characters
this.pendingEdit = {
offset: offset,
previousValue: hexElement.innerText === "+" ? undefined : hexElement.innerText,
newValue: keyPressed.charCodeAt(0).toString(16).toUpperCase(),
newValue: newValueHex,
element: element
};
element.classList.remove("add-cell");
Expand Down