highlight selection while dragging
[?]
Jun 3, 2022, 8:22 PM
5FW7YOFTLKHRND6IOR4HG4X3C5BO2WV5KTEUW3PPKCRU5L5GXKXQCDependencies
- [2]
TKFSYQ2Zup arrow to search previous - [3]
2ENZW7TVselect text using mouse drag - [4]
YPHKZVWMextract a new variable - [5]
BULPIBEGbeginnings of a module for the text editor - [6]
GE56XURAbugfix: cursor past end of screen line - [7]
2INHXC3Kposition cursor by clicking on text - [8]
HIH47LNBdrop unused arg - [9]
4NDYV4WDfix 2 bugs in line selection - [10]
PHQPLJUQrename - [11]
DHI6IJCNselecting text and deleting selections - [12]
UWNHC4AAredo y computations - [13]
DHCLUDCW. - [14]
NZ7V4BVSnote card - [15]
Z4XRNDTRfind text - [16]
HDC3AAQPsilly reason my screenshots had an ugly black line down the left - [17]
HYEAFRZ2split mouse_pressed events between Text and Drawing - [18]
2C7CTIQYmake space for multiple kinds of width - [19]
2RXZ3PGObeginning of a new approach to scroll+wrap - [20]
OTIBCAUJlove2d scaffold - [21]
IRV65LZPfold variables for screen dimensions into the app framework - [22]
AVQ5MC5Dfinish uppercasing all globals - [23]
DXT4QTAHa few more integer coordinates - [24]
HJ3PM2VT. - [25]
H2DPLWMVsnapshot: wrapping long lines at word boundaries - [26]
7IKRRESBlonger names for indices in long loops - [27]
BYG5CEMVsupport for naming points - [28]
DLQMM265scroll past first page - [29]
5L7K4GBDclicking to the right of a wrapped line - [30]
XX7G2FFJintermingle freehand line drawings with text - [31]
OYXDYPGSget rid of debug variables - [32]
VJ3ODCHRassert for a bug I saw a while ago but can no longer reproduce - [33]
HOSPP2ANcrisp font rendering - [34]
EDY3RQULgracefully handle a non-existent filename at the commandline - [35]
ULKLJBN6couple of renames - [36]
VJ77YABHmore efficient undo/redo - [37]
QU7NHFOVshow cursor - [38]
BOFNXP5Gclicking now moves the cursor even on long, wrapped lines - [*]
OIB2QPRCstart remembering where the cursor is drawn in px - [*]
AVTNUQYRbasic test-enabled framework
Change contents
- replacement in text.lua at line 216
-- Return any intersection of the region from Selection1 to Cursor1 with the-- region between {line=line_index, pos=apos} and {line=line_index, pos=bpos}.-- 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}-- and {line=line_index, pos=bpos}. - replacement in text.lua at line 226
local maxl,maxp = Cursor1.line,Cursor1.poslocal maxl,maxpif love.mouse.isDown('1') thenmaxl,maxp = Text.mouse_pos()elsemaxl,maxp = Cursor1.line,Cursor1.posend - edit in text.lua at line 261
endend-- inefficient for some reason, so don't do it on every framefunction Text.mouse_pos()local time = love.timer.getTime()if Recent_mouse.time and Recent_mouse.time > time-0.1 thenreturn Recent_mouse.line, Recent_mouse.posendRecent_mouse.time = timelocal line,pos = Text.to_pos(love.mouse.getX(), love.mouse.getY())if line thenRecent_mouse.line = lineRecent_mouse.pos = pos - edit in text.lua at line 276
return Recent_mouse.line, Recent_mouse.pos - edit in text.lua at line 279
function Text.to_pos(x,y)for line_index,line in ipairs(Lines) doif line.mode == 'text' thenif Text.in_line(line, x,y) thenreturn line_index, Text.to_pos_on_line(line, x,y)endendendend - replacement in text.lua at line 1864
-- mx,my in pixelsfunction Text.move_cursor(line_index, line, mx, my)Cursor1.line = line_index-- convert mx,my in pixels to schema-1 coordinatesfunction Text.to_pos_on_line(line, mx, my) - replacement in text.lua at line 1867
Cursor1.pos = Text.nearest_cursor_pos(line.data, mx)returnreturn Text.nearest_cursor_pos(line.data, mx) - replacement in text.lua at line 1880[4.437]→[4.7512:7585](∅→∅),[4.73]→[4.513:528](∅→∅),[4.7585]→[4.513:528](∅→∅),[4.513]→[4.513:528](∅→∅)
Cursor1.pos = line.screen_line_starting_pos[screen_line_index+1]returnreturn line.screen_line_starting_pos[screen_line_index+1] - replacement in text.lua at line 1883
Cursor1.pos = screen_line_starting_pos + Text.nearest_cursor_pos(s, mx) - 1returnreturn screen_line_starting_pos + Text.nearest_cursor_pos(s, mx) - 1 - edit in main.lua at line 58
Recent_mouse = {} -- when selecting text, avoid recomputing some state on every single frame - edit in main.lua at line 142
for line_index,line in ipairs(Lines) doline.y = nilend - replacement in main.lua at line 199
Text.move_cursor(line_index, line, x, y)Cursor1.line = line_indexCursor1.pos = Text.to_pos_on_line(line, x, y) - replacement in main.lua at line 219
Text.move_cursor(line_index, line, x, y)Cursor1.line = line_indexCursor1.pos = Text.to_pos_on_line(line, x, y) - edit in main.lua at line 231[41.1512][4.2944]
for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll - edit in main.lua at line 247[41.1550][4.3090]
for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll