966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
|
# File 'lib/textbringer/buffer.rb', line 966
def delete_region(s = @point, e = mark)
check_read_only_flag
old_pos = @point
s, e = Buffer.region_boundaries(s, e)
update_line_and_column(old_pos, s)
save_point do
str = substring(s, e)
@point = s
adjust_gap
len = e - s
@contents.bytesplice(@gap_end, len, "\0" * len)
@gap_end += len
@marks.each do |m|
if m.location > e
m.location -= len
elsif m.location > s
m.location = s
end
end
push_undo(DeleteAction.new(self, old_pos, s, str))
self.modified = true
end
end
|