about summary refs log tree commit diff stats
path: root/select.lua
diff options
context:
space:
mode:
Diffstat (limited to 'select.lua')
-rw-r--r--select.lua54
1 files changed, 0 insertions, 54 deletions
diff --git a/select.lua b/select.lua
index a24b828..8f0e7f8 100644
--- a/select.lua
+++ b/select.lua
@@ -80,60 +80,6 @@ function Text.mouse_pos(State)
   return State.screen_bottom1.line, Text.pos_at_end_of_screen_line(State, State.screen_bottom1)
 end
 
-function Text.cut_selection(State)
-  if State.selection1.line == nil then return end
-  local result = Text.selection(State)
-  Text.delete_selection(State)
-  return result
-end
-
-function Text.delete_selection(State)
-  if State.selection1.line == nil then return end
-  local minl,maxl = minmax(State.selection1.line, State.cursor1.line)
-  local before = snapshot(State, minl, maxl)
-  Text.delete_selection_without_undo(State)
-  record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
-end
-
-function Text.delete_selection_without_undo(State)
-  if State.selection1.line == nil then return end
-  -- min,max = sorted(State.selection1,State.cursor1)
-  local minl,minp = State.selection1.line,State.selection1.pos
-  local maxl,maxp = State.cursor1.line,State.cursor1.pos
-  if minl > maxl then
-    minl,maxl = maxl,minl
-    minp,maxp = maxp,minp
-  elseif minl == maxl then
-    if minp > maxp then
-      minp,maxp = maxp,minp
-    end
-  end
-  -- update State.cursor1 and State.selection1
-  State.cursor1.line = minl
-  State.cursor1.pos = minp
-  if Text.lt1(State.cursor1, State.screen_top1) then
-    State.screen_top1.line = State.cursor1.line
-    State.screen_top1.pos = Text.pos_at_start_of_screen_line(State, State.cursor1)
-  end
-  State.selection1 = {}
-  -- delete everything between min (inclusive) and max (exclusive)
-  Text.clear_screen_line_cache(State, minl)
-  local min_offset = Text.offset(State.lines[minl].data, minp)
-  local max_offset = Text.offset(State.lines[maxl].data, maxp)
-  if minl == maxl then
---?     print('minl == maxl')
-    State.lines[minl].data = State.lines[minl].data:sub(1, min_offset-1)..State.lines[minl].data:sub(max_offset)
-    return
-  end
-  assert(minl < maxl)
-  local rhs = State.lines[maxl].data:sub(max_offset)
-  for i=maxl,minl+1,-1 do
-    table.remove(State.lines, i)
-    table.remove(State.line_cache, i)
-  end
-  State.lines[minl].data = State.lines[minl].data:sub(1, min_offset-1)..rhs
-end
-
 function Text.selection(State)
   if State.selection1.line == nil then return end
   -- min,max = sorted(State.selection1,State.cursor1)