about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua72
1 files changed, 0 insertions, 72 deletions
diff --git a/edit.lua b/edit.lua
index edfcb20..54b8aa9 100644
--- a/edit.lua
+++ b/edit.lua
@@ -56,11 +56,6 @@ function edit.initialize_state(top, left, right, font, font_height, line_height)
     width = right-left,
 
     filename = love.filesystem.getSourceBaseDirectory()..'/lines.txt',  -- '/' should work even on Windows
-    next_save = nil,
-
-    -- undo
-    history = {},
-    next_history = 1,
 
     -- search
     search_term = nil,
@@ -124,25 +119,9 @@ function edit.draw(State)
 end
 
 function edit.update(State, dt)
-  if State.next_save and State.next_save < Current_time then
-    save_to_disk(State)
-    State.next_save = nil
-  end
-end
-
-function schedule_save(State)
-  if State.next_save == nil then
-    State.next_save = Current_time + 3  -- short enough that you're likely to still remember what you did
-  end
 end
 
 function edit.quit(State)
-  -- make sure to save before quitting
-  if State.next_save then
-    save_to_disk(State)
-    -- give some time for the OS to flush everything to disk
-    love.timer.sleep(0.1)
-  end
 end
 
 function edit.mouse_press(State, x,y, mouse_button, is_touch, presses)
@@ -251,10 +230,7 @@ function edit.text_input(State, t)
   if State.search_term then
     State.search_term = State.search_term..t
     Text.search_next(State)
-  else
-    Text.text_input(State, t)
   end
-  schedule_save(State)
 end
 
 function edit.keychord_press(State, chord, key, scancode, is_repeat)
@@ -309,29 +285,6 @@ function edit.keychord_press(State, chord, key, scancode, is_repeat)
   elseif chord == 'C-0' then
     edit.update_font_settings(State, 20)
     Text.redraw_all(State)
-  -- undo
-  elseif chord == 'C-z' then
-    local event = undo_event(State)
-    if event then
-      local src = event.before
-      State.screen_top1 = deepcopy(src.screen_top)
-      State.cursor1 = deepcopy(src.cursor)
-      State.selection1 = deepcopy(src.selection)
-      patch(State.lines, event.after, event.before)
-      Text.redraw_all(State)  -- if we're scrolling, reclaim all line caches to avoid memory leaks
-      schedule_save(State)
-    end
-  elseif chord == 'C-y' then
-    local event = redo_event(State)
-    if event then
-      local src = event.after
-      State.screen_top1 = deepcopy(src.screen_top)
-      State.cursor1 = deepcopy(src.cursor)
-      State.selection1 = deepcopy(src.selection)
-      patch(State.lines, event.before, event.after)
-      Text.redraw_all(State)  -- if we're scrolling, reclaim all line caches to avoid memory leaks
-      schedule_save(State)
-    end
   -- clipboard
   elseif chord == 'C-a' then
     State.selection1 = {line=1, pos=1}
@@ -341,31 +294,6 @@ function edit.keychord_press(State, chord, key, scancode, is_repeat)
     if s then
       App.set_clipboard(s)
     end
-  elseif chord == 'C-x' then
-    local s = Text.cut_selection_and_record_undo_event(State)
-    if s then
-      App.set_clipboard(s)
-    end
-    schedule_save(State)
-  elseif chord == 'C-v' then
-    -- We don't have a good sense of when to scroll, so we'll be conservative
-    -- and sometimes scroll when we didn't quite need to.
-    local before_line = State.cursor1.line
-    local before = snapshot(State, before_line)
-    local clipboard_data = App.get_clipboard()
-    for _,code in utf8.codes(clipboard_data) do
-      local c = utf8.char(code)
-      if c == '\n' then
-        Text.insert_return(State)
-      else
-        Text.insert_at_cursor(State, c)
-      end
-    end
-    if Text.cursor_out_of_screen(State) then
-      Text.snap_cursor_to_bottom_of_screen(State, State.left, State.right)
-    end
-    record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)})
-    schedule_save(State)
   else
     Text.keychord_press(State, chord, key, scancode, is_repeat)
   end
: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
-----------------------------------------------------------------------------
-- Canonic header field capitalization
-- LuaSocket toolkit.
-- Author: Diego Nehab
-----------------------------------------------------------------------------
socket.headers = {}
local _M = socket.headers

_M.canonic = {
    ["accept"] = "Accept",
    ["accept-charset"] = "Accept-Charset",
    ["accept-encoding"] = "Accept-Encoding",
    ["accept-language"] = "Accept-Language",
    ["accept-ranges"] = "Accept-Ranges",
    ["action"] = "Action",
    ["alternate-recipient"] = "Alternate-Recipient",
    ["age"] = "Age",
    ["allow"] = "Allow",
    ["arrival-date"] = "Arrival-Date",
    ["authorization"] = "Authorization",
    ["bcc"] = "Bcc",
    ["cache-control"] = "Cache-Control",
    ["cc"] = "Cc",
    ["comments"] = "Comments",
    ["connection"] = "Connection",
    ["content-description"] = "Content-Description",
    ["content-disposition"] = "Content-Disposition",
    ["content-encoding"] = "Content-Encoding",
    ["content-id"] = "Content-ID",
    ["content-language"] = "Content-Language",
    ["content-length"] = "Content-Length",
    ["content-location"] = "Content-Location",
    ["content-md5"] = "Content-MD5",
    ["content-range"] = "Content-Range",
    ["content-transfer-encoding"] = "Content-Transfer-Encoding",
    ["content-type"] = "Content-Type",
    ["cookie"] = "Cookie",
    ["date"] = "Date",
    ["diagnostic-code"] = "Diagnostic-Code",
    ["dsn-gateway"] = "DSN-Gateway",
    ["etag"] = "ETag",
    ["expect"] = "Expect",
    ["expires"] = "Expires",
    ["final-log-id"] = "Final-Log-ID",
    ["final-recipient"] = "Final-Recipient",
    ["from"] = "From",
    ["host"] = "Host",
    ["if-match"] = "If-Match",
    ["if-modified-since"] = "If-Modified-Since",
    ["if-none-match"] = "If-None-Match",
    ["if-range"] = "If-Range",
    ["if-unmodified-since"] = "If-Unmodified-Since",
    ["in-reply-to"] = "In-Reply-To",
    ["keywords"] = "Keywords",
    ["last-attempt-date"] = "Last-Attempt-Date",
    ["last-modified"] = "Last-Modified",
    ["location"] = "Location",
    ["max-forwards"] = "Max-Forwards",
    ["message-id"] = "Message-ID",
    ["mime-version"] = "MIME-Version",
    ["original-envelope-id"] = "Original-Envelope-ID",
    ["original-recipient"] = "Original-Recipient",
    ["pragma"] = "Pragma",
    ["proxy-authenticate"] = "Proxy-Authenticate",
    ["proxy-authorization"] = "Proxy-Authorization",
    ["range"] = "Range",
    ["received"] = "Received",
    ["received-from-mta"] = "Received-From-MTA",
    ["references"] = "References",
    ["referer"] = "Referer",
    ["remote-mta"] = "Remote-MTA",
    ["reply-to"] = "Reply-To",
    ["reporting-mta"] = "Reporting-MTA",
    ["resent-bcc"] = "Resent-Bcc",
    ["resent-cc"] = "Resent-Cc",
    ["resent-date"] = "Resent-Date",
    ["resent-from"] = "Resent-From",
    ["resent-message-id"] = "Resent-Message-ID",
    ["resent-reply-to"] = "Resent-Reply-To",
    ["resent-sender"] = "Resent-Sender",
    ["resent-to"] = "Resent-To",
    ["retry-after"] = "Retry-After",
    ["return-path"] = "Return-Path",
    ["sender"] = "Sender",
    ["server"] = "Server",
    ["smtp-remote-recipient"] = "SMTP-Remote-Recipient",
    ["status"] = "Status",
    ["subject"] = "Subject",
    ["te"] = "TE",
    ["to"] = "To",
    ["trailer"] = "Trailer",
    ["transfer-encoding"] = "Transfer-Encoding",
    ["upgrade"] = "Upgrade",
    ["user-agent"] = "User-Agent",
    ["vary"] = "Vary",
    ["via"] = "Via",
    ["warning"] = "Warning",
    ["will-retry-until"] = "Will-Retry-Until",
    ["www-authenticate"] = "WWW-Authenticate",
    ["x-mailer"] = "X-Mailer",
}

return _M