about summary refs log tree commit diff stats
path: root/src/linit.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-28 11:58:13 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-28 12:04:16 -0800
commit570af7c2550c77489d455297b9a1d7ae4baa674a (patch)
tree88f4c46a3a7301ac200c65b75d105235f85e01e6 /src/linit.c
parent462a45a39f8d6ce6194702270f3ce4f7f99d95a6 (diff)
downloadteliva-570af7c2550c77489d455297b9a1d7ae4baa674a.tar.gz
fix going to big picture after saving editor state
My code is already at spaghetti levels. Some coping mechanisms.

===
The big problem with the Teliva approach compared to my previous Mu
project: no tests. At this point I should document the growing list of
manual tests I've been maintaining:

  run a program
  run a program, edit
  run a program, edit, make an edit, run | edit takes effect
  run a program with error
  run a program, edit, make an error, run
  run a program, edit, ^g to a different definition, make an edit, ^e to run again
  run a program, edit, ^g to a non-existent definition
  run a program, edit, ^g to a different definition, ^g to a different definition, ^e to run again
  start -> big picture -> edit -> move cursor -> run -> edit | cursor preserved
  start -> big picture -> edit A -> move cursor -> big picture -> edit B | cursor initialized
  start -> big picture -> edit A -> move cursor -> run -> exit -> start -> big picture -> edit B | cursor initialized
  start -> big picture -> edit A -> move cursor -> run -> exit -> start -> big picture -> edit B -> big picture (*)

  syntax highlighting for line comments
  syntax highlighting for multiline comments

(*) - fixed in this commit

===
Coarse-grained state diagram (ignoring recent_changes_view):
  app -> big picture on ^e
  big picture -> editor when selecting a definition
  editor -> app on e
  editor -> big picture on ^b

Fine-grained sequence diagram:
  main -> pmain -> ... -> Wgetch -> switch_to_editor -> select_view
  select_view -> load_editor_state, falling through to big_picture_view if needed
  load_editor_state -> edit_from -> editorProcessKeypress

The consequence I hadn't fully internalized was the return path:
  editorProcessKeypress -> edit_from -> big_picture_view

Which implies that load_editor_state fails in two ways:
  - when the state doesn't exist or is not applicable or is corrupted
  - when editing from the state explicitly requested the big picture view

Switching the return value semantics for load_editor_state now supports
both ways.
Diffstat (limited to 'src/linit.c')
0 files changed, 0 insertions, 0 deletions