mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 19:34:29 +00:00
Skip empty terminal component maps during span edits
Avoid per-column component lookups and deletions when no component exceptions exist, retaining existing run and mixed-glyph editing. Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
This commit is contained in:
co-authored by
Jinjing
parent
b5c3ab69f5
commit
ccdd3ba2a0
@@ -96,8 +96,10 @@ export class HeadlessContentOrigins {
|
||||
this.pending = undefined
|
||||
const state = this.lines.get(pending.line)!
|
||||
const components = state.components
|
||||
for (let index = pending.start; index < pending.end; index++) {
|
||||
components.delete(index)
|
||||
if (components.size) {
|
||||
for (let index = pending.start; index < pending.end; index++) {
|
||||
components.delete(index)
|
||||
}
|
||||
}
|
||||
this.assign(pending.line, {
|
||||
runs: writeTerminalOrigins(
|
||||
|
||||
@@ -13,15 +13,17 @@ export function replaceOriginCells(
|
||||
from = 0
|
||||
): OriginLineState {
|
||||
const copied: [number, TerminalOriginRuns][] = []
|
||||
for (let index = from; source && index < from + end - start; index++) {
|
||||
for (let index = from; source?.components.size && index < from + end - start; index++) {
|
||||
const runs = source.components.get(index)
|
||||
if (runs) {
|
||||
copied.push([index - from + start, runs])
|
||||
}
|
||||
}
|
||||
const components = target.components
|
||||
for (let index = start; index < end; index++) {
|
||||
components.delete(index)
|
||||
if (components.size) {
|
||||
for (let index = start; index < end; index++) {
|
||||
components.delete(index)
|
||||
}
|
||||
}
|
||||
for (const [index, runs] of copied) {
|
||||
components.set(index, runs)
|
||||
|
||||
Reference in New Issue
Block a user