about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-30 19:36:37 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-30 19:36:37 -0700
commit08a50b7fff71324897eeb31a0d323d3444ef105b (patch)
treee063a2365c5ea663e56ddfb108f747e0f0d74315
parent510b0d1dc378f87517e17bfe1961fbefeb58d033 (diff)
downloadview.love-08a50b7fff71324897eeb31a0d323d3444ef105b.tar.gz
rip out the line-width slider
New plan:
  - render text across the whole window
  - let people resize the window to the desired line width
  - save window size settings between sessions
-rw-r--r--main.lua30
-rw-r--r--main_tests.lua18
2 files changed, 0 insertions, 48 deletions
diff --git a/main.lua b/main.lua
index de50b65..df20d60 100644
--- a/main.lua
+++ b/main.lua
@@ -96,9 +96,6 @@ Last_resize_time = nil
 -- blinking cursor
 Cursor_time = 0
 
--- line-width indicator
-Line_width_hover = nil
-
 end  -- App.initialize_globals
 
 function App.initialize(arg)
@@ -227,16 +224,6 @@ function App.draw()
     end
   end
 
-  -- line-width indicator
-  button('line-width', {x=Line_width-4,y=Margin_top-10, w=10,h=10, color={1,1,1},
-    icon = icon.line_width,
-    onpress1 = function() Line_width_hover = App.getTime() end,
-  })
-  if Line_width_hover then
-    love.graphics.setColor(0.7,0.7,0.7)
-    love.graphics.line(Line_width,Margin_top+2, Line_width,App.screen.height)
-  end
-
   assert(Text.le1(Screen_top1, Cursor1))
   Cursor_y = -1
   local y = Margin_top
@@ -306,18 +293,6 @@ function App.update(dt)
       Last_resize_time = nil
     end
   end
-  -- update Line_width with some hysteresis while the indicator is dragged
-  if Line_width_hover then
-    if App.getTime() - Line_width_hover > 0.1 then
-      Line_width = App.mouse_x()
-      Text.redraw_all()
-      if App.mouse_down(1) then
-        Line_width_hover = App.getTime()
-      else
-        Line_width_hover = nil
-      end
-    end
-  end
   Drawing.update(dt)
   if Next_save and Next_save < App.getTime() then
     save_to_disk(Lines, Filename)
@@ -342,11 +317,6 @@ function App.mousepressed(x,y, mouse_button)
   if Search_term then return end
   propagate_to_button_handlers(x,y, mouse_button)
 
-  -- we seem to sometimes get phantom clicks if the mouse moves down into text while adjusting line-width
-  if Line_width_hover then
-    Selection1 = {}
-    return
-  end
   for line_index,line in ipairs(Lines) do
     if line.mode == 'text' then
       if Text.in_line(line_index,line, x,y) then
diff --git a/main_tests.lua b/main_tests.lua
index a86c825..98cc73d 100644
--- a/main_tests.lua
+++ b/main_tests.lua
@@ -66,21 +66,3 @@ function test_drop_file_saves_previous()
   -- filesystem now contains a file called foo
   check_eq(App.filesystem['foo'], 'abc\ndef\n', 'F - test_drop_file_saves_previous')
 end
-
-function test_adjust_line_width()
-  io.write('\ntest_adjust_line_width')
-  Filename = 'foo'
-  App.screen.init{width=Margin_left+300, height=300}
-  Line_width = 256
-  App.draw()  -- initialize button
-  App.run_after_mouse_press(256, Margin_top-3, 1)
-  App.mouse_move(200, 37)
-  -- no change for some time
-  App.wait_fake_time(0.01)
-  App.update(0)
-  check_eq(Line_width, 256, 'F - test_adjust_line_width/early')
-  -- after 0.1s the change takes
-  App.wait_fake_time(0.1)
-  App.update(0)
-  check_eq(Line_width, 200, 'F - test_adjust_line_width')
-end