add state arg to some functions
[?]
Jul 12, 2022, 11:08 PM
X3F7ECSLGXCH6NBSDIH7LY47I4EG2RR5VFPEMM6ZVDYQIGFID4HQCDependencies
- [2]
LNUHQOGHstart passing in Editor_state explicitly - [3]
4VKEE43Zbugfix - [4]
Y36LOGR5bugfix: show cursor when past end of line - [5]
537TQ2QNsome more logging - [6]
M6TH7VSZrip out notion of Line_width - [7]
4CXVIEBSadd args to some functions - [8]
3TFEAQSWstart using some globals - [9]
JY4VK7L2rename - [10]
B3IWYWSRdelete another arg that can be deduced - [11]
BULPIBEGbeginnings of a module for the text editor - [12]
5DOC2CBMextract a function - [13]
A2NV3WVOscrolling with up arrow - [14]
JRGTJ2IWquite the frustrating bugfix - [15]
OIB2QPRCstart remembering where the cursor is drawn in px - [16]
CVGE3SIGI feel confident now that page-down is working. - [17]
QYIFOHW3first test! - [18]
GK47BBCYstart passing left/right margins everywhere - [19]
2L5MEZV3experiment: new edit namespace - [20]
EWMPYCDObugfix - [21]
J2SVGR2Eexperiment: blinking cursor - [22]
OYXDYPGSget rid of debug variables - [23]
LXTTOB33extract a couple of files - [24]
LF7BWEG4group all editor globals - [25]
KWOJ6XHEcut/copy selected text to clipboard - [26]
HIKLULFQextract a function - [27]
FYQQTPRPthe problem is that the cursor can occlude text - [28]
H2DPLWMVsnapshot: wrapping long lines at word boundaries - [29]
FHSZYAZ2more precise search highlighting - [30]
WLHI7KD3new globals: draw partial screen line up top - [31]
2ZRC7FUL. - [32]
4KC7I3E2make colors easier to edit - [33]
5DOTWNVMright margin - [34]
AYE2VEGJextract a couple of methods - [35]
2RXZ3PGObeginning of a new approach to scroll+wrap - [36]
Z4XRNDTRfind text - [37]
XNFTJHC4split keyboard handling between Text and Drawing - [38]
DHI6IJCNselecting text and deleting selections - [39]
LERERVPHkeep one screen line of overlap on pagedown - [40]
BOFNXP5Gclicking now moves the cursor even on long, wrapped lines - [41]
HOSPP2ANcrisp font rendering - [42]
LAW2O3NWextract variable Margin_left
Change contents
- replacement in text.lua at line 12
function Text.draw(line, line_index, top, left, right)function Text.draw(State, line, line_index, top, left, right) - replacement in text.lua at line 31
--? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(right)..') '..s(line_index)..' vs '..s(Editor_state.screen_top1.line)..'; '..s(pos)..' vs '..s(Editor_state.screen_top1.pos)..'; bottom: '..s(Editor_state.screen_bottom1.line)..'/'..s(Editor_state.screen_bottom1.pos))--? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(right)..') '..s(line_index)..' vs '..s(State.screen_top1.line)..'; '..s(pos)..' vs '..s(State.screen_top1.pos)..'; bottom: '..s(State.screen_bottom1.line)..'/'..s(State.screen_bottom1.pos)) - replacement in text.lua at line 35
if Text.lt1(Editor_state.screen_top1, {line=line_index, pos=pos}) theny = y + Editor_state.line_heightif y + Editor_state.line_height > App.screen.height thenif Text.lt1(State.screen_top1, {line=line_index, pos=pos}) theny = y + State.line_heightif y + State.line_height > App.screen.height then - replacement in text.lua at line 46
--? print('checking to draw', pos, Editor_state.screen_top1.pos)--? print('checking to draw', pos, State.screen_top1.pos) - replacement in text.lua at line 48
if Text.le1(Editor_state.screen_top1, {line=line_index, pos=pos}) thenif Editor_state.selection1.line thenif Text.le1(State.screen_top1, {line=line_index, pos=pos}) thenif State.selection1.line then - replacement in text.lua at line 57
if line_index == Editor_state.cursor1.line thenif pos <= Editor_state.cursor1.pos and pos + frag_len > Editor_state.cursor1.pos thenif Editor_state.search_term thenif Editor_state.lines[Editor_state.cursor1.line].data:sub(Editor_state.cursor1.pos, Editor_state.cursor1.pos+utf8.len(Editor_state.search_term)-1) == Editor_state.search_term thenlocal lo_px = Text.draw_highlight(line, x,y, pos, Editor_state.cursor1.pos, Editor_state.cursor1.pos+utf8.len(Editor_state.search_term))if line_index == State.cursor1.line thenif pos <= State.cursor1.pos and pos + frag_len > State.cursor1.pos thenif State.search_term thenif State.lines[State.cursor1.line].data:sub(State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term)-1) == State.search_term thenlocal lo_px = Text.draw_highlight(line, x,y, pos, State.cursor1.pos, State.cursor1.pos+utf8.len(State.search_term)) - replacement in text.lua at line 63
love.graphics.print(Editor_state.search_term, x+lo_px,y)love.graphics.print(State.search_term, x+lo_px,y) - replacement in text.lua at line 66
Text.draw_cursor(x+Text.x(frag, Editor_state.cursor1.pos-pos+1), y)Text.draw_cursor(State, x+Text.x(frag, State.cursor1.pos-pos+1), y) - replacement in text.lua at line 73
if Editor_state.search_term == nil thenif line_index == Editor_state.cursor1.line and Editor_state.cursor1.pos == pos thenText.draw_cursor(x, y)if State.search_term == nil thenif line_index == State.cursor1.line and State.cursor1.pos == pos thenText.draw_cursor(State, x, y) - replacement in text.lua at line 83
function Text.draw_cursor(x, y)function Text.draw_cursor(State, x, y) - replacement in text.lua at line 87
love.graphics.rectangle('fill', x,y, 3,Editor_state.line_height)love.graphics.rectangle('fill', x,y, 3,State.line_height) - replacement in text.lua at line 90
Editor_state.cursor_x = xEditor_state.cursor_y = y+Editor_state.line_heightState.cursor_x = xState.cursor_y = y+State.line_height - replacement in search.lua at line 3
function Text.draw_search_bar()local h = Editor_state.line_height+2function Text.draw_search_bar(State)local h = State.line_height+2 - replacement in search.lua at line 15
App.screen.print(Editor_state.search_term, 25,y-5)App.screen.print(State.search_term, 25,y-5) - replacement in search.lua at line 17
if Editor_state.search_text == nil thenEditor_state.search_text = App.newText(love.graphics.getFont(), Editor_state.search_term)if State.search_text == nil thenState.search_text = App.newText(love.graphics.getFont(), State.search_term) - replacement in search.lua at line 20
love.graphics.circle('fill', 25+App.width(Editor_state.search_text),y-5+h, 2)love.graphics.circle('fill', 25+App.width(State.search_text),y-5+h, 2) - replacement in edit.lua at line 147
Text.draw_cursor(State.margin_left, y)Text.draw_cursor(State, State.margin_left, y) - replacement in edit.lua at line 164
y, State.screen_bottom1.pos = Text.draw(line, line_index, line.starty, State.margin_left, App.screen.width-State.margin_right)y, State.screen_bottom1.pos = Text.draw(State, line, line_index, line.starty, State.margin_left, App.screen.width-State.margin_right) - replacement in edit.lua at line 174
Text.draw_search_bar()Text.draw_search_bar(State)