diff options
Diffstat (limited to 'select.lua')
-rw-r--r-- | select.lua | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/select.lua b/select.lua index 7e48274..78affdc 100644 --- a/select.lua +++ b/select.lua @@ -71,24 +71,22 @@ function Text.mouse_pos(State) return State.screen_top1.line, State.screen_top1.pos end for line_index,line in ipairs(State.lines) do - if line.mode == 'text' then - if Text.in_line(State, line_index, x,y) then - return line_index, Text.to_pos_on_line(State, line_index, x,y) - end + if Text.in_line(State, line_index, x,y) then + return line_index, Text.to_pos_on_line(State, line_index, x,y) end end local screen_bottom1 = Text.screen_bottom1(State) return screen_bottom1.line, Text.pos_at_end_of_screen_line(State, screen_bottom1) end -function Text.cut_selection(State) +function Text.cut_selection_and_record_undo_event(State) if State.selection1.line == nil then return end local result = Text.selection(State) - Text.delete_selection(State) + Text.delete_selection_and_record_undo_event(State) return result end -function Text.delete_selection(State) +function Text.delete_selection_and_record_undo_event(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) @@ -156,9 +154,7 @@ function Text.selection(State) assert(minl < maxl, ('minl %d not < maxl %d'):format(minl, maxl)) local result = {State.lines[minl].data:sub(min_offset)} for i=minl+1,maxl-1 do - if State.lines[i].mode == 'text' then - table.insert(result, State.lines[i].data) - end + table.insert(result, State.lines[i].data) end table.insert(result, State.lines[maxl].data:sub(1, max_offset-1)) return table.concat(result, '\n') |