stop pretending globals are local

One advantage of this approach: we don't end up with multiple lexical
scopes containing duplicates of the same modules.
This commit is contained in:
Kartik K. Agaram 2022-07-11 22:11:48 -07:00
parent e68d235c5f
commit 3dccd7f81a
6 changed files with 5 additions and 19 deletions

View File

@ -1,7 +1,5 @@
-- primitives for editing drawings
Drawing = {}
geom = require 'geom'
require 'drawing_tests'
-- All drawings span 100% of some conceptual 'page width' and divide it up
@ -719,5 +717,3 @@ function table.find(h, x)
end
end
end
return Drawing

View File

@ -1,6 +1,4 @@
-- primitives for saving to file and loading from file
Drawing = require 'drawing'
function load_from_disk(filename)
local infile = App.open_for_reading(filename)
local result = load_from_file(infile)

View File

@ -1,4 +1,4 @@
local geom = {}
geom = {}
function geom.on_shape(x,y, drawing, shape)
if shape.mode == 'freehand' then
@ -166,5 +166,3 @@ function geom.angle_between(ox,oy, x,y, s,e)
end
function geom.dist(x1,y1, x2,y2) return ((x2-x1)^2+(y2-y1)^2)^0.5 end
return geom

View File

@ -1,4 +1,4 @@
local utf8 = require 'utf8'
utf8 = require 'utf8'
require 'app'
require 'test'
@ -6,9 +6,9 @@ require 'test'
require 'keychord'
require 'file'
require 'button'
local Text = require 'text'
local Drawing = require 'drawing'
local geom = require 'geom'
require 'text'
require 'drawing'
require 'geom'
require 'help'
require 'icons'

View File

@ -1,7 +1,5 @@
-- helpers for selecting portions of text
local utf8 = require 'utf8'
-- Return any intersection of the region from Selection1 to Cursor1 (or
-- current mouse, if mouse is pressed; or recent mouse if mouse is pressed and
-- currently over a drawing) with the region between {line=line_index, pos=apos}

View File

@ -1,8 +1,6 @@
-- text editor, particularly text drawing, horizontal wrap, vertical scrolling
Text = {}
local utf8 = require 'utf8'
require 'search'
require 'select'
require 'undo'
@ -1010,5 +1008,3 @@ function Text.clear_cache(line)
line.fragments = nil
line.screen_line_starting_pos = nil
end
return Text