| 148 | public lastAsciiPos: number = this.firstAsciiPos + 16; |
| 149 | |
| 150 | private getOffset(pos: vscode.Position): number { |
| 151 | // check if within a valid section |
| 152 | if (pos.line < 1 || pos.character < this.firstBytePos) { |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | let offset = (pos.line - 1) * 16; |
| 157 | const s = pos.character - this.firstBytePos; |
| 158 | if (pos.character >= this.firstBytePos && pos.character <= this.lastBytePos) { |
| 159 | // byte section |
| 160 | offset += Math.floor(s / 3); |
| 161 | } else if (pos.character >= this.firstAsciiPos) { |
| 162 | // ascii section |
| 163 | offset += (pos.character - this.firstAsciiPos); |
| 164 | } |
| 165 | return offset; |
| 166 | } |
| 167 | |
| 168 | private getPosition(offset: number, ascii: boolean = false): vscode.Position { |
| 169 | const row = 1 + Math.floor(offset / 16); |