add state arg to a few functions
[?]
Jul 12, 2022, 11:55 PM
MTJEVRJR5GLWUSK7HMIM4UXM6GS6O6YCRWJT3DUSU2RYMHCQNOEQCDependencies
- [2]
DLQAEAC7add state arg to Drawing.mouse_pressed - [3]
23MA4T3Gadd state arg to Drawing.keychord_pressed - [4]
Z5HLXU4Padd state arg to a few functions - [5]
S2MISTTMadd state arg to a few functions - [6]
DRFE3B3Zmouse buttons are integers, not strings - [7]
PTDO2SOTadd state arg to schedule_save - [8]
LXTTOB33extract a couple of files - [9]
SPSW74Y5add state arg to Text.keychord_pressed - [10]
PHFWIFYKscroll on enter - [11]
SQLVYKVJrename - [12]
3MAZEQK5add state arg to Text.textinput - [13]
IRCKL6VNextract scrolling logic out of insert_at_cursor - [14]
DHI6IJCNselecting text and deleting selections - [15]
CG3264MMmove - [16]
LNUHQOGHstart passing in Editor_state explicitly - [17]
XNFTJHC4split keyboard handling between Text and Drawing - [18]
4CXVIEBSadd args to some functions - [19]
QXVD2RIFadd state arg to Drawing.mouse_released - [20]
73OCE2MCafter much struggle, a brute-force undo - [21]
2ZYV7D3Whandle tab characters - [22]
7LVK4KRDfix a failing test - [23]
NQKFQSZEundo creating new drawings - [24]
2RXZ3PGObeginning of a new approach to scroll+wrap - [25]
5UG5PQ6Kundo commit 861c57b533 - [26]
AYE2VEGJextract a couple of methods - [27]
3TDOZESEextract scrolling logic out of insert_return - [28]
GN3IF4WFbugfix: pasting newlines - [29]
LF7BWEG4group all editor globals - [30]
YW5324Q3bugfix: cut (C-x) without first selecting anything - [31]
3GFQP6IRstop saving the entire file when modifying drawings - [32]
PX7DDEMOautosave slightly less aggressively - [33]
2L5MEZV3experiment: new edit namespace - [34]
VJ77YABHmore efficient undo/redo - [35]
EMHRPJ3Rno, that's not right - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- replacement in undo.lua at line 9
function record_undo_event(data)Editor_state.history[Editor_state.next_history] = dataEditor_state.next_history = Editor_state.next_history+1for i=Editor_state.next_history,#Editor_state.history doEditor_state.history[i] = nilfunction record_undo_event(State, data)State.history[State.next_history] = dataState.next_history = State.next_history+1for i=State.next_history,#State.history doState.history[i] = nil - replacement in undo.lua at line 17
function undo_event()if Editor_state.next_history > 1 then--? print('moving to history', Editor_state.next_history-1)Editor_state.next_history = Editor_state.next_history-1local result = Editor_state.history[Editor_state.next_history]function undo_event(State)if State.next_history > 1 then--? print('moving to history', State.next_history-1)State.next_history = State.next_history-1local result = State.history[State.next_history] - replacement in undo.lua at line 26
function redo_event()if Editor_state.next_history <= #Editor_state.history then--? print('restoring history', Editor_state.next_history+1)local result = Editor_state.history[Editor_state.next_history]Editor_state.next_history = Editor_state.next_history+1function redo_event(State)if State.next_history <= #State.history then--? print('restoring history', State.next_history+1)local result = State.history[State.next_history]State.next_history = State.next_history+1 - replacement in undo.lua at line 37
function snapshot(s,e)function snapshot(State, s,e) - replacement in undo.lua at line 43
assert(#Editor_state.lines > 0)assert(#State.lines > 0) - replacement in undo.lua at line 45
if s > #Editor_state.lines then s = #Editor_state.lines endif s > #State.lines then s = #State.lines end - replacement in undo.lua at line 47
if e > #Editor_state.lines then e = #Editor_state.lines endif e > #State.lines then e = #State.lines end - replacement in undo.lua at line 50
screen_top=deepcopy(Editor_state.screen_top1),selection=deepcopy(Editor_state.selection1),cursor=deepcopy(Editor_state.cursor1),screen_top=deepcopy(State.screen_top1),selection=deepcopy(State.selection1),cursor=deepcopy(State.cursor1), - replacement in undo.lua at line 54
previous_drawing_mode=Editor_state.previous_drawing_mode,previous_drawing_mode=State.previous_drawing_mode, - replacement in undo.lua at line 62
local line = Editor_state.lines[i]local line = State.lines[i] - replacement in text.lua at line 140
local before = snapshot(State.cursor1.line)local before = snapshot(State, State.cursor1.line) - replacement in text.lua at line 148
record_undo_event({before=before, after=snapshot(State.cursor1.line)})record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)}) - replacement in text.lua at line 164
local before = snapshot(before_line)local before = snapshot(State, before_line) - replacement in text.lua at line 171
record_undo_event({before=before, after=snapshot(before_line, State.cursor1.line)})record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)}) - replacement in text.lua at line 173
local before = snapshot(State.cursor1.line)local before = snapshot(State, State.cursor1.line) - replacement in text.lua at line 182
record_undo_event({before=before, after=snapshot(State.cursor1.line)})record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)}) - replacement in text.lua at line 191
before = snapshot(State.cursor1.line)before = snapshot(State, State.cursor1.line) - replacement in text.lua at line 203
before = snapshot(State.cursor1.line-1, State.cursor1.line)before = snapshot(State, State.cursor1.line-1, State.cursor1.line) - replacement in text.lua at line 223
record_undo_event({before=before, after=snapshot(State.cursor1.line)})record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)}) - replacement in text.lua at line 232
before = snapshot(State.cursor1.line)before = snapshot(State, State.cursor1.line) - replacement in text.lua at line 234
before = snapshot(State.cursor1.line, State.cursor1.line+1)before = snapshot(State, State.cursor1.line, State.cursor1.line+1) - replacement in text.lua at line 258
record_undo_event({before=before, after=snapshot(State.cursor1.line)})record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)}) - replacement in select.lua at line 113
local before = snapshot(minl, maxl)local before = snapshot(State, minl, maxl) - replacement in select.lua at line 115
record_undo_event({before=before, after=snapshot(State.cursor1.line)})record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)}) - replacement in edit.lua at line 136
Drawing.before = snapshot(line_index-1, line_index)Drawing.before = snapshot(State, line_index-1, line_index) - replacement in edit.lua at line 142
record_undo_event({before=Drawing.before, after=snapshot(line_index-1, line_index+1)})record_undo_event(State, {before=Drawing.before, after=snapshot(State, line_index-1, line_index+1)}) - replacement in edit.lua at line 230
Drawing.before = snapshot(line_index)Drawing.before = snapshot(State, line_index) - replacement in edit.lua at line 245
record_undo_event({before=Drawing.before, after=snapshot(State.lines.current_drawing_index)})record_undo_event(State, {before=Drawing.before, after=snapshot(State, State.lines.current_drawing_index)}) - replacement in edit.lua at line 284
local before = snapshot(State.lines.current_drawing_index)local before = snapshot(State, State.lines.current_drawing_index) - replacement in edit.lua at line 288
record_undo_event({before=before, after=snapshot(State.lines.current_drawing_index)})record_undo_event(State, {before=before, after=snapshot(State, State.lines.current_drawing_index)}) - replacement in edit.lua at line 343
local event = undo_event()local event = undo_event(State) - replacement in edit.lua at line 355
local event = redo_event()local event = redo_event(State) - replacement in edit.lua at line 384
local before = snapshot(before_line)local before = snapshot(State, before_line) - replacement in edit.lua at line 398
record_undo_event({before=before, after=snapshot(before_line, State.cursor1.line)})record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)}) - replacement in edit.lua at line 404
local before = snapshot(drawing_index)local before = snapshot(State, drawing_index) - replacement in edit.lua at line 406
record_undo_event({before=before, after=snapshot(drawing_index)})record_undo_event(State, {before=before, after=snapshot(State, drawing_index)}) - replacement in edit.lua at line 420
local before = snapshot(State.lines.current_drawing_index)local before = snapshot(State, State.lines.current_drawing_index) - replacement in edit.lua at line 425
record_undo_event({before=before, after=snapshot(State.lines.current_drawing_index)})record_undo_event(State, {before=before, after=snapshot(State, State.lines.current_drawing_index)}) - replacement in edit.lua at line 431
record_undo_event({before=before, after=snapshot(State.lines.current_drawing_index)})record_undo_event(State, {before=before, after=snapshot(State, State.lines.current_drawing_index)})