about summary refs log tree commit diff stats
path: root/source_edit.lua
diff options
context:
space:
mode:
Diffstat (limited to 'source_edit.lua')
-rw-r--r--source_edit.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/source_edit.lua b/source_edit.lua
index e376537..1e8259c 100644
--- a/source_edit.lua
+++ b/source_edit.lua
@@ -68,8 +68,10 @@ function edit.initialize_state(top, left, right, font, font_height, line_height)
     --
     -- Make sure these coordinates are never aliased, so that changing one causes
     -- action at a distance.
+    --
+    -- On lines that are drawings, pos will be nil.
     screen_top1 = {line=1, pos=1},  -- position of start of screen line at top of screen
-    cursor1 = {line=1, pos=1},  -- position of cursor
+    cursor1 = {line=1, pos=1},  -- position of cursor; must be on a text line
     screen_bottom1 = {line=1, pos=1},  -- position of start of screen line at bottom of screen
 
     selection1 = {},
@@ -190,6 +192,7 @@ function edit.draw(State, hide_cursor, show_line_numbers)
                        Drawing.before = snapshot(State, line_index-1, line_index)
                        table.insert(State.lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})
                        table.insert(State.line_cache, line_index, {})
+                       for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end
                        if State.cursor1.line >= line_index then
                          State.cursor1.line = State.cursor1.line+1
                        end
@@ -296,10 +299,7 @@ function edit.mouse_press(State, x,y, mouse_button)
   State.old_cursor1 = State.cursor1
   State.old_selection1 = State.selection1
   State.mousepress_shift = App.shift_down()
-  State.selection1 = {
-      line=State.screen_bottom1.line,
-      pos=Text.pos_at_end_of_screen_line(State, State.screen_bottom1),
-  }
+  State.selection1 = Text.final_text_loc_on_screen(State)
 end
 
 function edit.mouse_release(State, x,y, mouse_button)
@@ -337,7 +337,7 @@ function edit.mouse_release(State, x,y, mouse_button)
     end
 
     -- still here? mouse release is below all screen lines
-    State.cursor1.line, State.cursor1.pos = State.screen_bottom1.line, Text.pos_at_end_of_screen_line(State, State.screen_bottom1)
+    State.cursor1 = Text.final_text_loc_on_screen(State)
     edit.clean_up_mouse_press(State)
 --?     print_and_log(('edit.mouse_release: finally selection %s,%s cursor %d,%d'):format(tostring(State.selection1.line), tostring(State.selection1.pos), State.cursor1.line, State.cursor1.pos))
   end
@@ -600,6 +600,7 @@ end
 function edit.run_after_mouse_click(State, x,y, mouse_button)
   App.fake_mouse_press(x,y, mouse_button)
   edit.mouse_press(State, x,y, mouse_button)
+  edit.draw(State)
   App.fake_mouse_release(x,y, mouse_button)
   edit.mouse_release(State, x,y, mouse_button)
   App.screen.contents = {}
11-27 22:30:38 +0100 committer hut <hut@lavabit.com> 2009-11-27 22:30:38 +0100 embedded wrapper.sh into ranger.py' href='/akspecs/ranger/commit/ranger.py?h=v1.4.1&id=a66c4a26f79d71210422f7d977b892d5a700dae8'>a66c4a26 ^
3de15ddd ^
a66c4a26 ^


f027adc0 ^
5c210a96 ^

3de15ddd ^

5c210a96 ^
fb275079 ^

5c210a96 ^
3d566884 ^
a1d7ed6e ^
3d566884 ^
621a1a39 ^
9bc5d95c ^
c44b726e ^
465bff73 ^




f027adc0 ^
f8e96a97 ^

0b5c4cbe ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61