mirror of
https://gitlab.com/c3d/db48x.git
synced 2024-09-29 05:36:58 +02:00
ui: Do not insert an extra space before parentheses in equation
When hitting F F, we expect `'()'` and not `' ()'`. Fixes: #1160 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
parent
444bd8a3d1
commit
fc3c46fbda
2 changed files with 8 additions and 7 deletions
12
src/tests.cc
12
src/tests.cc
|
@ -716,7 +716,7 @@ void tests::keyboard_entry()
|
|||
|
||||
step("Separators with auto-spacing");
|
||||
cstring seps2 = "{}()[]";
|
||||
cstring seps2auto = "{ } ( ) []";
|
||||
cstring seps2auto = "{ } () []";
|
||||
test(CLEAR, seps2).editor(seps2auto);
|
||||
|
||||
step("Key repeat");
|
||||
|
@ -743,13 +743,13 @@ void tests::keyboard_entry()
|
|||
.test(KEY3).editor("'1=2+3'");
|
||||
step("F key in equation inserts parentheses")
|
||||
.test(MUL).editor("'1=2+3·'")
|
||||
.test(F).editor("'1=2+3· ()'");
|
||||
.test(F).editor("'1=2+3·()'");
|
||||
step("Automatic insertion of parentheses after functions")
|
||||
.test(D).editor("'1=2+3· (exp())'")
|
||||
.test(KEY0).editor("'1=2+3· (exp(0))'");
|
||||
.test(D).editor("'1=2+3·(exp())'")
|
||||
.test(KEY0).editor("'1=2+3·(exp(0))'");
|
||||
step("Space key in parentheses insert semi-colon")
|
||||
.test(SPACE).editor("'1=2+3· (exp(0;))'")
|
||||
.test(KEY7).editor("'1=2+3· (exp(0;7))'");
|
||||
.test(SPACE).editor("'1=2+3·(exp(0;))'")
|
||||
.test(KEY7).editor("'1=2+3·(exp(0;7))'");
|
||||
|
||||
step("STO key while entering equation (bug #390)")
|
||||
.test(CLEAR, EXIT, KEY1, KEY2, F,
|
||||
|
|
|
@ -193,7 +193,8 @@ void user_interface::edit(unicode c, modes m, bool autoclose)
|
|||
if (closing && autoclose)
|
||||
{
|
||||
byte *ed = rt.editor();
|
||||
if (mode == PROGRAM || mode == DIRECT || is_algebraic(mode))
|
||||
if (mode == PROGRAM || mode == DIRECT ||
|
||||
(is_algebraic(mode) && c != '('))
|
||||
if (savec > 0 && ed[savec] != ' ')
|
||||
insert(savec, ' ');
|
||||
size_t back = insert(cursor, closing);
|
||||
|
|
Loading…
Reference in a new issue