= Deletion = parameters: (Del.B, Del.E). environment: Buffer, (All.Bp, All.Ep), (Gap.Bp, Gap.Ep). pregap-part = (All.Bp, Gap.Bp) & (Del.B, Del.E). gap-part = (All.Bp, Gap.Bp) & (Del.B, Del.E). postgap-part = (Gap.Ep, All.Ep) & (Del.B, Del.E). possible actions in order to delete: 1) move entire gap. 2) move beginning of gap. 3) move end of gap. 4) move some block (M.B, M.E) by some relative amount. Probably the postgap-part. or combinations thereof. Goal: keep total cost small. Have only one gap at most (can summarize adjacent gaps into one, though). Keep gap size under a configurable #maximum-gap-size, preferring large block moves otherwise. = Cost of actions = A. Move the gap beginning to the left: a b c G G d e f ^-- ----- 1 | +-> 1 a b G G G c d e f cost = (Gap.Bp - Gap.B) + (All.Ep - Gap.Ep). B. Move the gap beginning to the right: a b c G G d e f --> X --- 1 | <-+ 1 a b c d G e f cost =~ (Gap.B - Gap.Bp) + (All.Ep - Gap.Ep). C. Move the gap end to the left: a b c G G d e f |----- <-+ | 1 <-+ 1 a b c G d e f cost = (All.Ep - Gap.Ep). D. Move the gap end to the right: a b c G G d e f |----- | | | +-> | 1 +-> 1 cost = (All.Ep - Gap.Ep). E. Move the entire gap to the left: a b c G G d e f --- | <-+ 1 a b G G c d e f cost = (Gap.Bp - Gap.B). F. Move the entire gap to the right: a b c G G d e f --- | | << +-> 1 a b c d G G e f cost = (Gap.B - Gap.Bp). G. Move some block (M.B, M.E): cost = (M.E - M.B). = Low Level = A. Move the gap beginning to the left: cost = (Gap.Bp - Gap.B) + (All.Ep - Gap.Ep). B. Move the gap beginning to the right: cost =~ (Gap.B - Gap.Bp) + (All.Ep - Gap.Ep). C. Move the gap end to the left: cost = (All.Ep - Gap.Ep). D. Move the gap end to the right: cost = (All.Ep - Gap.Ep). E. Move the entire gap to the left: cost = (Gap.Bp - Gap.B). F. Move the entire gap to the right: cost = (Gap.B - Gap.Bp). G. Move some block (M.B, M.E): cost = (M.E - M.B). special cases: H. Give a gap up: cost = (All.Ep - Gap.E). or maybe not all the way until All.Ep if a new gap is introduced in-between. parameters: (Del.B, Del.E). environment: Buffer, (All.Bp, All.Ep), (Gap.Bp, Gap.Ep). pregap-part = (All.Bp, Gap.Bp) & (Del.B, Del.E). gap-part = (All.Bp, Gap.Bp) & (Del.B, Del.E). postgap-part = (Gap.Ep, All.E) & (Del.B, Del.E). Direct gap manipulation can be done if the items to be deleted are adjacent to the gap. If they're not, either make it so that they are or delete the items manually, leaving the gap as-is or modified in a different way.