diff -uNr a/yrc/codemap.txt b/yrc/codemap.txt --- a/yrc/codemap.txt 5f2f130c0194f6f03a2eebdceca4f4936875cc449c1e9040adb318037f1d0ee6ca75ebc85302053197bb3394e7ad0a198f262135e26db0f7c09145a47af41db7 +++ b/yrc/codemap.txt 770974cfdcc65af191d32cd4929febd6cb1e01d181307746c8a00cb8638af6e468db987916661af1112870c6e810d4fcb93ddf5020fd486d87c2145afb979b29 @@ -82,6 +82,7 @@ self_pipe_rd: int self_pipe_wr: int +commands: (name: str) => function Global state ============ @@ -98,7 +99,6 @@ Collections =========== -commands: (name: str) => function buffers: non-empty list of buf buffer_index: (name: str, parent_name: str) => buf opening_conns: (fileno: int) => conn diff -uNr a/yrc/manifest b/yrc/manifest --- a/yrc/manifest ae6bd2e7be742bf1e83941f2a8d0a18a600c992ff7c99bdd1df0d82c9c81f700e29dee073f6fb118348877ad7b2e6d2d85811867d09a4017c86d22ae1836add5 +++ b/yrc/manifest 8ad4a90cf4bb0fa513b82afdb1149f6c16e3d183531f1992c8e1df8a9e81978c83d65beeb63bc4748b0dfced29d85c00fa64835e5f7f8ba5de3814d5574b0ca5 @@ -1,2 +1,3 @@ 632836 yrc_subdir_genesis jfw Initial V release of yrc, version 97K (regrind of yrc_genesis to follow the project subdir and manifest naming conventions and indent with tabs rather than spaces) 633652 yrc_linear_scroll_etc jfw Version 96K with smooth/linear scrolling, Python 2.6 compat, yrc2local log formatter, bugfixes and more: see NEWS for details. +768770 yrc_minor_refactors_reorders jfw Move prompt_clear to a higher layer by making it use the prompt_chars accessor: it now deletes entries from a fixed character list container rather than replacing the list as a whole. Expand prompt_backspace not to stack on top of prompt_delete, coming out only slightly longer. Tighten some prompt commands (such as backspace/delete) to skip unnecessary redraw. In codemap.txt, reclassify commands dict as a quasiconstant since it doesn't change after startup. diff -uNr a/yrc/yrc.py b/yrc/yrc.py --- a/yrc/yrc.py 27a0dab1a22aad54ce93d7805e682c8ad5a26655ee0b62bc9014fc557af97f3b123bad1a94dd0a25fe0167742b00ec6e08a699e50f016d80ea7b8ccc474a4366 +++ b/yrc/yrc.py 8676ae2cd7fae54dd7f6c06ba6e08235dadd31de4b10459bdb03a1e54a7deb35c26dc0108cd0e3228d465fb0899e67e9d4b282ff0677253734fc5f81dcab9aa2 @@ -807,12 +807,6 @@ prompt_hscroll = lambda: prompt[2] prompt_cursor_column = lambda: prompt[3] -def prompt_clear(): - schedule_prompt_draw() - prompt[0] = [] - prompt_set_cursor(0) - prompt_set_hscroll(0) - def prompt_set_cursor(c): schedule_prompt_draw() if 0 <= c <= len(prompt_chars()): @@ -827,6 +821,12 @@ def prompt_set_cursor_column(c): prompt[3] = c +def prompt_clear(): + schedule_prompt_draw() + del prompt_chars()[:] + prompt_set_cursor(0) + prompt_set_hscroll(0) + def prompt_insert(char): schedule_prompt_draw() c = prompt_cursor() @@ -835,26 +835,27 @@ @command('prompt-delete') def prompt_delete(): - schedule_prompt_draw() c = prompt_cursor() chars = prompt_chars() if c < len(chars): chars.pop(c) + schedule_prompt_draw() @command('prompt-backspace') def prompt_backspace(): - schedule_prompt_draw() - c = prompt_cursor() - if prompt_set_cursor(c - 1): - prompt_delete() + c = prompt_cursor() - 1 + if c >= 0: + prompt_set_cursor(c) + prompt_chars().pop(c) + schedule_prompt_draw() @command('prompt-submit') def prompt_submit(): - schedule_prompt_draw() line = ''.join(prompt_chars()) - prompt_clear() if len(line) == 0: return + prompt_clear() + schedule_prompt_draw() try: if line.startswith('/'): line = line[1:]