function execute(self, command) if command == "\2" then self:backup() -- control B elseif command == "\6" then self:forward() -- control F elseif command == "\127" then self:delete() -- delete character elseif command == "\11" then self:kill_line() -- control K elseif command == "\19" then self:search_forward() -- control S else self:insert(command) end end function kill_line(self) while not self:eobp() and string.sub(self.data, self.pos, 1) ~= "\n" do self:forward() self:delete() end if not self:eobp() then self:forward(); self:delete() end end function eobp(self) return self.pos == #(self.data) + 1 end