diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-06-10 23:56:37 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-06-10 23:56:37 -0700 |
commit | df0f36fb40fcd5d1a334cb0889bcb7f78023e638 (patch) | |
tree | 0cf59c92fc7801542fc36e1c67073bec7c1b7198 /030container.cc | |
parent | 909adb27f9df2ba58e703562e3cf8f948fc58b56 (diff) | |
download | mu-df0f36fb40fcd5d1a334cb0889bcb7f78023e638.tar.gz |
3906
Yet another attempt at decomposing incremental edits in some clean way. The new idea now is that I need to only modify the screen using a restricted vocabulary of actions: render-all render-recipe-side render-sandbox-side render-recipe-errors render-line-from-cursor render-line-from-start erase-line-from-cursor render-character-at-cursor erase-character-at-cursor However, decomposing insert-at-cursor is challenging; how to manipulate cursor-row and cursor-column without also pretending to print to screen? Do I need to decompose `editor` into multiple containers so that I can keep cursor-row and cursor-column with screen modifications? Here's what `editor` looks like after all layers: container editor [ data:&:duplex-list:char top-of-screen:&:duplex-list:char bottom-of-screen:&:duplex-list:char before-cursor:&:duplex-list:char left:num right:num bottom:num cursor-row:num cursor-column:num indent?:bool undo:&:list:&:operation redo:&:list:&:operation ] It's not obvious that there's a clean way to split all these fields.
Diffstat (limited to '030container.cc')
-rw-r--r-- | 030container.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/030container.cc b/030container.cc index 2e5da42e..507dace3 100644 --- a/030container.cc +++ b/030container.cc @@ -900,3 +900,16 @@ void check_invalid_types(const type_tree* type, const string& location_for_error raise << location_for_error_messages << "unknown type in " << name_for_error_messages << '\n' << end(); } } + +string to_original_string(const type_ordinal t) { + ostringstream out; + if (!contains_key(Type, t)) return out.str(); + const type_info& info = get(Type, t); + if (info.kind == PRIMITIVE) return out.str(); + out << (info.kind == CONTAINER ? "container" : "exclusive-container") << " " << info.name << " [\n"; + for (int i = 0; i < SIZE(info.elements); ++i) { + out << " " << info.elements.at(i).original_string << "\n"; + } + out << "]\n"; + return out.str(); +} |