mirror of
https://github.com/c3d/DB48X-on-DM42.git
synced 2024-09-28 03:20:53 +02:00
menus: Do not execute if-then-else and similar
Commands like `if then else` should not evaluate from the menu, but always insert in the text editor. Fixes: #1014 Fixes: #1015 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
parent
189694f6e5
commit
d2cccb096c
3 changed files with 25 additions and 4 deletions
|
@ -131,6 +131,7 @@ ID_RANGE(is_unit, unit, unit)
|
|||
ID_RANGE(is_plot, Function, Parametric)
|
||||
ID_RANGE(is_program, program, funcall)
|
||||
ID_RANGE(is_graph, grob, bitmap)
|
||||
ID_RANGE(is_forced_entry, IfThen, CaseWhen, IfErrThen, IfErrThenElse)
|
||||
|
||||
|
||||
|
||||
|
|
17
src/tests.cc
17
src/tests.cc
|
@ -162,7 +162,7 @@ void tests::run(bool onlyCurrent)
|
|||
if (onlyCurrent)
|
||||
{
|
||||
here().begin("Current");
|
||||
complex_arithmetic();
|
||||
editor_operations();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -804,7 +804,20 @@ void tests::editor_operations()
|
|||
.test(DOWN)
|
||||
.editor("'x and y'")
|
||||
.test(ENTER);
|
||||
}
|
||||
|
||||
step("Insert if-then from menu")
|
||||
.test(CLEAR, LSHIFT, KEY3, LSHIFT, F2, LSHIFT, F1)
|
||||
.editor("if then end ");
|
||||
step("Insert if-then-else from menu")
|
||||
.test(CLEAR, LSHIFT, KEY3, LSHIFT, F2, LSHIFT, F2)
|
||||
.editor("if then else end ");
|
||||
step("Insert iferr-then from menu")
|
||||
.test(CLEAR, LSHIFT, KEY3, LSHIFT, F2, LSHIFT, F3)
|
||||
.editor("iferr then end ");
|
||||
step("Insert iferr-then-else from menu")
|
||||
.test(CLEAR, LSHIFT, KEY3, LSHIFT, F2, LSHIFT, F4)
|
||||
.editor("iferr then else end ");
|
||||
}
|
||||
|
||||
|
||||
void tests::stack_operations()
|
||||
|
|
|
@ -4455,6 +4455,13 @@ bool user_interface::handle_functions(int key)
|
|||
{
|
||||
save<int> saveEvaluating(evaluating, key);
|
||||
object::id ty = obj->type();
|
||||
if (object::is_forced_entry(ty))
|
||||
{
|
||||
dirtyEditor = true;
|
||||
edRows = 0;
|
||||
return obj->insert() != object::ERROR;
|
||||
}
|
||||
|
||||
bool imm = object::is_immediate(ty);
|
||||
bool editing = rt.editing();
|
||||
if (editing && !imm)
|
||||
|
|
Loading…
Reference in a new issue