From 6374398f3692b6e2a6472da4faff91dcd1397a2f Mon Sep 17 00:00:00 2001 From: mipa83 Date: Thu, 22 Jan 2026 10:27:23 +0100 Subject: [PATCH 01/31] Update db48x.48k Signed-off-by: mipa83 --- config/db48x.48k | 56 ++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/config/db48x.48k b/config/db48x.48k index 8e2e11608..afcac37ef 100644 --- a/config/db48x.48k +++ b/config/db48x.48k @@ -1,4 +1,4 @@ -@ PLANE 0: UNSHIFTED +// PLANE 0: UNSHIFTED [ ToolsMenu inv sqrt pow MathMenu UIAlgebraic Store ToggleCustomMenu StackMenu sin cos tan @@ -8,8 +8,7 @@ Edit "4" "5" "6" * UILeftShift "1" "2" "3" - UIExit "0" UIDecimal Run + ] - -@ PLANE 1: LEFT SHIFTED +// PLANE 1: LEFT SHIFTED [ LastMenu exp sq abs PowersMenu EquationsMenu ComplexMenu MemoryMenu ConstantsMenu asin acos atan @@ -19,8 +18,7 @@ EditMenu BasesMenu UnitsMenu FlagsMenu ProbabilitiesMenu UIRightShift ToDecimal ToggleUserMode ProgramMenu ListMenu OffWithImage SystemSetup Show "« »" Catalog ] - -@ PLANE 2: RIGHT SHIFTED +// PLANE 2: RIGHT SHIFTED [ MainMenu ln xroot AlgebraMenu PartsMenu CharactersMenu RealMenu Library FractionsMenu HyperbolicMenu CircularMenu AnglesMenu @@ -30,8 +28,7 @@ EditMenu TextMenu UnitsConversionsMenu TimeMenu NumbersMenu UINoShift DebugMenu LoopsMenu TestsMenu ObjectMenu SaveState FilesMenu GraphicsMenu "{ }" Help ] - -@ PLANE 3: ALPHA UNSHIFTED +// PLANE 3: ALPHA UNSHIFTED [ "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" @@ -39,33 +36,29 @@ UIEnter "M" "N" "O" UIBackspace UILeft "P" "Q" "R" "S" UIRight "T" "U" "V" "W" UILeftShift "X" "Y" "Z" "_" -UIExit ": :" "," " " ";" +UIExit ": :" "," " " Catalog ] - -@ PLANE 4: ALPHA LEFT SHIFTED +// PLANE 4: ALPHA LEFT SHIFTED [ "Σ" "^" "√" "∂" "ρ" "(" "▶" "%" "π" "<" "=" ">" UILowercase "⇄" "±" "∡" UIDelete UILeft "7" "8" "9" "÷" UIRight "4" "5" "6" "×" -UIRightShift "1" "2" "3" "-" -OffWithImage "0" "." "« »" "+" +UIRightShift "1" "2" "3" "-" +OffWithImage "0" UIDecimal "« »" "+" ] - -@ PLANE 5: ALPHA RIGHT SHIFTED +// PLANE 5: ALPHA RIGHT SHIFTED [ "∏" "∆" "↑" "μ" "θ" "\" "→" "←" "↓" "≤" "≠" "≥" -"""" "~" "°" "ε" " -" +UIText "~" "°" "ε" UINewLine UIUp "?" "∫" "[" "/" UIDown "#" "∞" "|" "*" UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!' +OffWithImage ";" "·" "{ }" "!" ] - -@ PLANE 6: LOWERCASE UNSHIFTED +// PLANE 6: LOWERCASE UNSHIFTED [ "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" @@ -73,26 +66,23 @@ UIEnter "m" "n" "o" UIBackspace UILeft "p" "q" "r" "s" UIRight "t" "u" "v" "w" UILeftShift "x" "y" "z" "_" -UIExit ": :" "," " " ";" +UIExit ": :" "," " " Catalog ] - -@ PLANE 7: LOWERCASE LEFT SHIFTED +// PLANE 7: LOWERCASE LEFT SHIFTED [ -"A" "B" "C" "D" "E" "F" -"G" "H" "I" "J" "K" "L" -UINoAlpha "M" "N" "O" UIDelete -UILeft "P" "Q" "R" "S" -UIRight "T" "U" "V" "W" -UIRightShift "X" "Y" "Z" "_" -OffWithImage ": :" "," ";" "?" +"Σ" "^" "√" "∂" "ρ" "(" +"▶" "%" "π" "<" "=" ">" +UILowercase "⇄" "±" "∡" UIDelete +UILeft "7" "8" "9" "÷" +UIRight "4" "5" "6" "×" +UIRightShift "1" "2" "3" "-" +OffWithImage "0" UIDecimal "« »" "+" ] - -@ PLANE 8: LOWERCASE RIGHT SHIFTED +// PLANE 8: LOWERCASE RIGHT SHIFTED [ "α" "β" "γ" "δ" "ε" "φ" "Γ" "θ" "Δ" "λ" "λ" "ν" -UINoAlpha "Π" "Σ" "ω" " -" +UINoAlpha "Π" "Σ" "ω" UINewLine UIUp "?" "∫" "[" "/" UIDown "#" "∞" "|" "*" UINoShift "&" "@" "$" "…" From 7ec0cc9de1ebdc4df4a5bdabdba977f626847c2c Mon Sep 17 00:00:00 2001 From: mipa83 Date: Thu, 22 Jan 2026 14:05:54 +0100 Subject: [PATCH 02/31] Update user_interface.cc TODOs - I need some help with * excluding : a) static const char numbers[] b) static const char upper[] c) static const char lower[] d) static const unicode shifted[] e) static const unicode xshifted[] and using the object form .k48-file Hey-Keybaord not supported yet neg in "" not supportet yet Signed-off-by: mipa83 --- src/user_interface.cc | 420 ++++++++++++++++++++++-------------------- 1 file changed, 216 insertions(+), 204 deletions(-) diff --git a/src/user_interface.cc b/src/user_interface.cc index acfc29b1f..3a96c443b 100644 --- a/src/user_interface.cc +++ b/src/user_interface.cc @@ -659,13 +659,13 @@ bool user_interface::key(int key, bool repeating, bool talpha) } // Handle keys - bool result = + bool result = handle_shifts(key, talpha) || handle_help(key) || handle_user(key) || handle_editing(key) || - handle_alpha(key) || - handle_digits(key) || + //handle_alpha(key) || //TO-DO + //handle_digits(key) || //TO-DO handle_functions(key) || key == 0; @@ -4159,7 +4159,7 @@ bool user_interface::handle_help(int &key) // Handle help keys when showing help // ---------------------------------------------------------------------------- { - if (!showing_help()) + if (!showing_help()) { // Exit if we are editing or entering digits if (last == KEY_SHIFT || Stack.interactive) @@ -5222,10 +5222,10 @@ bool user_interface::handle_digits(int key) return true; } - } + } if (key > KEY_CHS && key < KEY_F1) { - unicode c = numbers[key - 1]; + unicode c = numbers[key - 1]; if (~searching) { bool found = false; @@ -5261,196 +5261,196 @@ bool user_interface::handle_digits(int key) -// ============================================================================ -// -// Tables with the default assignments -// -// ============================================================================ - -static const byte defaultUnshiftedCommand[2*user_interface::NUM_KEYS] = -// ---------------------------------------------------------------------------- -// RPL code for the commands assigned by default to each key -// ---------------------------------------------------------------------------- -// All the default-assigned commands fit in one or two bytes -{ -#define OP2BYTES(key, id) \ - [2*(key) - 2] = (id) < 0x80 ? (id) & 0x7F : ((id) & 0x7F) | 0x80, \ - [2*(key) - 1] = (id) < 0x80 ? 0 : ((id) >> 7) - - OP2BYTES(KEY_SIGMA, menu::ID_ToolsMenu), - OP2BYTES(KEY_INV, function::ID_inv), - OP2BYTES(KEY_SQRT, function::ID_sqrt), - OP2BYTES(KEY_LOG, function::ID_pow), - OP2BYTES(KEY_LN, function::ID_MathMenu), - OP2BYTES(KEY_XEQ, 0), - OP2BYTES(KEY_STO, command::ID_Sto), - OP2BYTES(KEY_RCL, command::ID_ToggleCustomMenu), - OP2BYTES(KEY_RDN, menu::ID_StackMenu), - OP2BYTES(KEY_SIN, function::ID_sin), - OP2BYTES(KEY_COS, function::ID_cos), - OP2BYTES(KEY_TAN, function::ID_tan), - OP2BYTES(KEY_ENTER, function::ID_Dup), - OP2BYTES(KEY_SWAP, function::ID_Swap), - OP2BYTES(KEY_CHS, function::ID_neg), - OP2BYTES(KEY_E, function::ID_Cycle), - OP2BYTES(KEY_BSP, command::ID_Drop), - OP2BYTES(KEY_UP, 0), - OP2BYTES(KEY_7, 0), - OP2BYTES(KEY_8, 0), - OP2BYTES(KEY_9, 0), - OP2BYTES(KEY_DIV, arithmetic::ID_divide), - OP2BYTES(KEY_DOWN, 0), - OP2BYTES(KEY_4, 0), - OP2BYTES(KEY_5, 0), - OP2BYTES(KEY_6, 0), - OP2BYTES(KEY_MUL, arithmetic::ID_multiply), - OP2BYTES(KEY_SHIFT, 0), - OP2BYTES(KEY_1, 0), - OP2BYTES(KEY_2, 0), - OP2BYTES(KEY_3, 0), - OP2BYTES(KEY_SUB, command::ID_subtract), - OP2BYTES(KEY_EXIT, 0), - OP2BYTES(KEY_0, 0), - OP2BYTES(KEY_DOT, 0), - OP2BYTES(KEY_RUN, command::ID_Run), - OP2BYTES(KEY_ADD, command::ID_add), - - OP2BYTES(KEY_F1, 0), - OP2BYTES(KEY_F2, 0), - OP2BYTES(KEY_F3, 0), - OP2BYTES(KEY_F4, 0), - OP2BYTES(KEY_F5, 0), - OP2BYTES(KEY_F6, 0), - - OP2BYTES(KEY_SCREENSHOT, command::ID_ScreenCapture), - OP2BYTES(KEY_SH_UP, 0), - OP2BYTES(KEY_SH_DOWN, 0), -}; - - -static const byte defaultShiftedCommand[2*user_interface::NUM_KEYS] = -// ---------------------------------------------------------------------------- -// RPL code for the commands assigned by default to shifted keys -// ---------------------------------------------------------------------------- -// All the default assigned commands fit in one or two bytes -{ - OP2BYTES(KEY_SIGMA, menu::ID_LastMenu), - OP2BYTES(KEY_INV, arithmetic::ID_exp), - OP2BYTES(KEY_SQRT, arithmetic::ID_sq), - OP2BYTES(KEY_LOG, function::ID_abs), - OP2BYTES(KEY_LN, function::ID_PowersMenu), - OP2BYTES(KEY_XEQ, menu::ID_EquationsMenu), - OP2BYTES(KEY_STO, menu::ID_ComplexMenu), - OP2BYTES(KEY_RCL, menu::ID_MemoryMenu), - OP2BYTES(KEY_RDN, menu::ID_ConstantsMenu), - OP2BYTES(KEY_SIN, function::ID_asin), - OP2BYTES(KEY_COS, function::ID_acos), - OP2BYTES(KEY_TAN, function::ID_atan), - OP2BYTES(KEY_ENTER, 0), // Alpha - OP2BYTES(KEY_SWAP, menu::ID_LastArg), - OP2BYTES(KEY_CHS, menu::ID_ModesMenu), - OP2BYTES(KEY_E, menu::ID_DisplayModesMenu), - OP2BYTES(KEY_BSP, menu::ID_ClearThingsMenu), - OP2BYTES(KEY_UP, 0), - OP2BYTES(KEY_7, menu::ID_SolverMenu), - OP2BYTES(KEY_8, menu::ID_IntegrationMenu), - OP2BYTES(KEY_9, 0), // Insert [] - OP2BYTES(KEY_DIV, menu::ID_StatisticsMenu), - OP2BYTES(KEY_DOWN, 0), - OP2BYTES(KEY_4, menu::ID_BasesMenu), - OP2BYTES(KEY_5, menu::ID_UnitsMenu), - OP2BYTES(KEY_6, menu::ID_FlagsMenu), - OP2BYTES(KEY_MUL, menu::ID_ProbabilitiesMenu), - OP2BYTES(KEY_SHIFT, 0), - OP2BYTES(KEY_1, function::ID_ToDecimal), - OP2BYTES(KEY_2, command::ID_ToggleUserMode), - OP2BYTES(KEY_3, menu::ID_ProgramMenu), - OP2BYTES(KEY_SUB, menu::ID_ListMenu), - OP2BYTES(KEY_EXIT, command::ID_OffWithImage), - OP2BYTES(KEY_0, command::ID_SystemSetup), - OP2BYTES(KEY_DOT, command::ID_Show), - OP2BYTES(KEY_RUN, 0), - OP2BYTES(KEY_ADD, menu::ID_Catalog), - - OP2BYTES(KEY_F1, 0), - OP2BYTES(KEY_F2, 0), - OP2BYTES(KEY_F3, 0), - OP2BYTES(KEY_F4, 0), - OP2BYTES(KEY_F5, 0), - OP2BYTES(KEY_F6, 0), - - OP2BYTES(KEY_SCREENSHOT, command::ID_ScreenCapture), - OP2BYTES(KEY_SH_UP, 0), - OP2BYTES(KEY_SH_DOWN, 0), -}; - - -static const byte defaultSecondShiftedCommand[2*user_interface::NUM_KEYS] = -// ---------------------------------------------------------------------------- -// RPL code for the commands assigned by default to long-shifted keys -// ---------------------------------------------------------------------------- -// All the default assigned commands fit in one or two bytes -{ - OP2BYTES(KEY_SIGMA, menu::ID_MainMenu), - OP2BYTES(KEY_INV, command::ID_ln), - OP2BYTES(KEY_SQRT, menu::ID_xroot), - OP2BYTES(KEY_LOG, menu::ID_AlgebraMenu), - OP2BYTES(KEY_LN, menu::ID_PartsMenu), - OP2BYTES(KEY_XEQ, menu::ID_CharactersMenu), - OP2BYTES(KEY_STO, menu::ID_RealMenu), - OP2BYTES(KEY_RCL, menu::ID_Library), - OP2BYTES(KEY_RDN, menu::ID_FractionsMenu), - OP2BYTES(KEY_SIN, menu::ID_HyperbolicMenu), - OP2BYTES(KEY_COS, menu::ID_CircularMenu), - OP2BYTES(KEY_TAN, menu::ID_AnglesMenu), - OP2BYTES(KEY_ENTER, 0), // Text - OP2BYTES(KEY_SWAP, function::ID_Undo), - OP2BYTES(KEY_CHS, menu::ID_UserInterfaceModesMenu), - OP2BYTES(KEY_E, menu::ID_PlotMenu), - OP2BYTES(KEY_BSP, function::ID_UpDir), - OP2BYTES(KEY_UP, 0), - OP2BYTES(KEY_7, menu::ID_SymbolicMenu), - OP2BYTES(KEY_8, menu::ID_PolynomialsMenu), - OP2BYTES(KEY_9, menu::ID_MatrixMenu), - OP2BYTES(KEY_DIV, menu::ID_FinanceSolverMenu), - OP2BYTES(KEY_DOWN, menu::ID_EditMenu), - OP2BYTES(KEY_4, menu::ID_TextMenu), - OP2BYTES(KEY_5, menu::ID_UnitsConversionsMenu), - OP2BYTES(KEY_6, menu::ID_TimeMenu), - OP2BYTES(KEY_MUL, menu::ID_NumbersMenu), - OP2BYTES(KEY_SHIFT, 0), - OP2BYTES(KEY_1, menu::ID_DebugMenu), - OP2BYTES(KEY_2, menu::ID_LoopsMenu), - OP2BYTES(KEY_3, menu::ID_TestsMenu), - OP2BYTES(KEY_SUB, menu::ID_IOMenu), - OP2BYTES(KEY_EXIT, command::ID_SaveState), - OP2BYTES(KEY_0, menu::ID_FilesMenu), - OP2BYTES(KEY_DOT, menu::ID_GraphicsMenu), - OP2BYTES(KEY_RUN, 0), - OP2BYTES(KEY_ADD, command::ID_Help), - - OP2BYTES(KEY_F1, 0), - OP2BYTES(KEY_F2, 0), - OP2BYTES(KEY_F3, 0), - OP2BYTES(KEY_F4, 0), - OP2BYTES(KEY_F5, 0), - OP2BYTES(KEY_F6, 0), - - OP2BYTES(KEY_SCREENSHOT, command::ID_ScreenCapture), - OP2BYTES(KEY_SH_UP, 0), - OP2BYTES(KEY_SH_DOWN, 0), -}; - - -static const byte *const defaultCommand[user_interface::NUM_PLANES] = -// ---------------------------------------------------------------------------- -// Pointers to the default commands -// ---------------------------------------------------------------------------- -{ - defaultUnshiftedCommand, - defaultShiftedCommand, - defaultSecondShiftedCommand, -}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bool user_interface::load_keymap(cstring name) @@ -5472,13 +5472,16 @@ bool user_interface::load_keymap(cstring name) scribble scr; bool quoted = false; list_g result; - + unicode c; + unicode d = ' '; + bool e = false; while (kmap.valid()) { - unicode c = kmap.get(); - if (c == '@') + c = d; + d = kmap.get(); + if (c == '/' && d == '/' && !quoted) { - do { c = kmap.get(); } while (c && c != '\n'); + do { d = kmap.get(); } while (d != '\n'); continue; } if (c == '"') @@ -5567,9 +5570,9 @@ object_p user_interface::object_for_key(int key) if (object_p keyobj = plane->at(key-1)) return keyobj; - const byte *ptr = defaultCommand[plane] + 2 * (key - 1); - if (*ptr) - obj = (object_p) ptr; + + + return obj; } @@ -5595,7 +5598,7 @@ bool user_interface::handle_user(int key) // Check if we have one of the user-defined functions // ---------------------------------------------------------------------------- { - if (!key || !Settings.UserMode()) + if (!key || !Settings.UserMode()) return false; bool result = false; @@ -6069,6 +6072,15 @@ bool user_interface::do_delete(bool forward) return true; } +bool user_interface::do_new_line() +// ---------------------------------------------------------------------------- +// Insert New Line +// ---------------------------------------------------------------------------- +{ + insert('\n', DIRECT); + return true; +} + bool user_interface::do_algebraic() // ---------------------------------------------------------------------------- From 2f421b65231819949d40f2b68788aa078c7734e0 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Sun, 25 Jan 2026 22:25:59 +0100 Subject: [PATCH 03/31] Update user_interface.h Signed-off-by: mipa83 --- src/user_interface.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/user_interface.h b/src/user_interface.h index 81a4d8440..777835aff 100644 --- a/src/user_interface.h +++ b/src/user_interface.h @@ -211,6 +211,7 @@ struct user_interface bool do_up(); bool do_down(); bool do_delete(bool forward); + bool do_new_line(); text_p editor_save(text_r ed, bool rewinding = false); text_p editor_save(bool rewinding = false); From 969420cd05c7572e470a97e8fbc72e63a4a09e76 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:21:30 +0100 Subject: [PATCH 04/31] Update legacy.48k Signed-off-by: mipa83 --- config/legacy.48k | 58 ++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/config/legacy.48k b/config/legacy.48k index 955242787..b6dd87cf5 100644 --- a/config/legacy.48k +++ b/config/legacy.48k @@ -1,6 +1,6 @@ -@ PLANE 0: UNSHIFTED +// PLANE 0: UNSHIFTED [ -ToolsMenu inv sqrt exp ln UIAlgebraic +ToolsMenu inv sqrt log10 ln UIAlgebraic Store ToggleCustomMenu StackMenu sin cos tan Duplicate Swap neg Cycle Drop StackEditor "7" "8" "9" / @@ -8,10 +8,9 @@ Edit "4" "5" "6" * UILeftShift "1" "2" "3" - UIExit "0" UIDecimal Run + ] - -@ PLANE 1: LEFT SHIFTED +// PLANE 1: LEFT SHIFTED [ -LastMenu pow sq exp10 log10 LoopsMenu +LastMenu pow sq exp10 exp LoopsMenu ComplexMenu FractionsMenu ConstantsMenu asin acos atan UIAlpha LastArg ModesMenu DisplayModesMenu ClearThingsMenu EditorHistory SolverMenu IntegrationMenu "[ ]" StatisticsMenu @@ -19,8 +18,7 @@ EditMenu BasesMenu UnitsMenu FlagsMenu ProbabilitiesMenu UIRightShift ToDecimal ToggleUserMode ProgramMenu ListMenu OffWithImage SystemSetup Show "« »" Catalog ] - -@ PLANE 2: RIGHT SHIFTED +// PLANE 2: RIGHT SHIFTED [ MainMenu xroot PolynomialsMenu PowersMenu PartsMenu EquationsMenu MemoryMenu Library MathMenu HyperbolicMenu CircularMenu RealMenu @@ -30,8 +28,7 @@ EditMenu TextMenu UnitsConversionsMenu TimeMenu NumbersMenu UINoShift DebugMenu CharactersMenu TestsMenu IOMenu SaveState FilesMenu GraphicsMenu "{ }" Help ] - -@ PLANE 3: ALPHA UNSHIFTED +// PLANE 3: ALPHA UNSHIFTED [ "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" @@ -39,10 +36,9 @@ UIEnter "M" "N" "O" UIBackspace UILeft "P" "Q" "R" "S" UIRight "T" "U" "V" "W" UILeftShift "X" "Y" "Z" "_" -UIExit ": :" "," " " ";" +UIExit ": :" "," " " Catalog ] - -@ PLANE 4: ALPHA LEFT SHIFTED +// PLANE 4: ALPHA LEFT SHIFTED [ "Σ" "^" "√" "∂" "ρ" "(" "▶" "%" "π" "<" "=" ">" @@ -50,22 +46,19 @@ UILowercase "⇄" "±" "∡" UIDelete UILeft "7" "8" "9" "÷" UIRight "4" "5" "6" "×" UIRightShift "1" "2" "3" "-" -OffWithImage "0" "." "« »" "+" +OffWithImage "0" UIDecimal "« »" "+" ] - -@ PLANE 5: ALPHA RIGHT SHIFTED +// PLANE 5: ALPHA RIGHT SHIFTED [ "∏" "∆" "↑" "μ" "θ" "\" "→" "←" "↓" "≤" "≠" "≥" -"""" "~" "°" "ε" " -" +UIText "~" "°" "ε" UINewLine UIUp "?" "∫" "[" "/" UIDown "#" "∞" "|" "*" UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!' +OffWithImage ";" "·" "{ }" "!" ] - -@ PLANE 6: LOWERCASE UNSHIFTED +// PLANE 6: LOWERCASE UNSHIFTED [ "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" @@ -73,26 +66,23 @@ UIEnter "m" "n" "o" UIBackspace UILeft "p" "q" "r" "s" UIRight "t" "u" "v" "w" UILeftShift "x" "y" "z" "_" -UIExit ": :" "," " " ";" +UIExit ": :" "," " " Catalog ] - -@ PLANE 7: LOWERCASE LEFT SHIFTED +// PLANE 7: LOWERCASE LEFT SHIFTED [ -"A" "B" "C" "D" "E" "F" -"G" "H" "I" "J" "K" "L" -UINoAlpha "M" "N" "O" UIDelete -UILeft "P" "Q" "R" "S" -UIRight "T" "U" "V" "W" -UIRightShift "X" "Y" "Z" "_" -OffWithImage ": :" "," ";" "?" +"Σ" "^" "√" "∂" "ρ" "(" +"▶" "%" "π" "<" "=" ">" +UILowercase "⇄" "±" "∡" UIDelete +UILeft "7" "8" "9" "÷" +UIRight "4" "5" "6" "×" +UIRightShift "1" "2" "3" "-" +OffWithImage "0" UIDecimal "« »" "+" ] - -@ PLANE 8: LOWERCASE RIGHT SHIFTED +// PLANE 8: LOWERCASE RIGHT SHIFTED [ "α" "β" "γ" "δ" "ε" "φ" "Γ" "θ" "Δ" "λ" "λ" "ν" -UINoAlpha "Π" "Σ" "ω" " -" +UINoAlpha "Π" "Σ" "ω" UINewLine UIUp "?" "∫" "[" "/" UIDown "#" "∞" "|" "*" UINoShift "&" "@" "$" "…" From da3679417b519f9d2623383754246c5f66d5a125 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:23:35 +0100 Subject: [PATCH 05/31] Update 6-ImplementationStatus.md: add 3x * UINewLine Signed-off-by: mipa83 --- doc/6-ImplementationStatus.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/6-ImplementationStatus.md b/doc/6-ImplementationStatus.md index 0c9444e88..56252a2bc 100644 --- a/doc/6-ImplementationStatus.md +++ b/doc/6-ImplementationStatus.md @@ -847,6 +847,7 @@ spellings. * `UILeft` * `UILeftShift` * `UILowercase` +* `UINewLine` * `UINoAlpha` * `UINoShift` * `UIRight` @@ -1797,6 +1798,7 @@ The following is an extensive list of commands. * `UILeft` * `UILeftShift` * `UILowercase` +* `UINewLine` * `UINoAlpha` * `UINoShift` * `UIRight` @@ -2746,6 +2748,7 @@ The following is an extensive list of commands. * `UILeft` * `UILeftShift` * `UILowercase` +* `UINewLine` * `UINoAlpha` * `UINoShift` * `UIRight` From d91134e6832bd56f1b2cf22c9fb92e23325b2bb3 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:27:04 +0100 Subject: [PATCH 06/31] Update db48x.md: add `UINewLine` Signed-off-by: mipa83 --- help/db48x.md | 1 + 1 file changed, 1 insertion(+) diff --git a/help/db48x.md b/help/db48x.md index 41b410e22..0b70e8c41 100644 --- a/help/db48x.md +++ b/help/db48x.md @@ -5409,6 +5409,7 @@ The following is an extensive list of commands. * `UILeft` * `UILeftShift` * `UILowercase` +* `UINewLine` * `UINoAlpha` * `UINoShift` * `UIRight` From 4f119077790586280b509f0dec19bf972c956a38 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:28:46 +0100 Subject: [PATCH 07/31] Update command.h: add UINewLine Signed-off-by: mipa83 --- src/command.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/command.h b/src/command.h index 3cf862543..96ebbeee1 100644 --- a/src/command.h +++ b/src/command.h @@ -212,5 +212,6 @@ COMMAND_DECLARE(UIUp,-1); // Actions related to up key COMMAND_DECLARE(UIDown,-1); // Actions related to down key COMMAND_DECLARE(UIBackspace,-1); // Actions related to backspace COMMAND_DECLARE(UIDelete,-1); // Action related to delete +COMMAND_DECLARE(UINewLine,-1); // Action related to new line #endif // COMMAND_H From d1a47b6a6c22f133a9dd22e040819720855337b7 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:32:10 +0100 Subject: [PATCH 08/31] Update command.cc: add UINewLine Signed-off-by: mipa83 --- src/command.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/command.cc b/src/command.cc index 342a9387c..600e796b6 100644 --- a/src/command.cc +++ b/src/command.cc @@ -1760,3 +1760,11 @@ COMMAND_BODY(UIDelete) { return ui.do_delete(true) ? OK : ERROR; } + +COMMAND_BODY(UINewLine) +// ---------------------------------------------------------------------------- +// Insert new line +// ---------------------------------------------------------------------------- +{ + return ui.do_new_line() ? OK : ERROR; +} From 0ece6a4ebf6f19d3a1d31cb7a2bc6b8393bdaa7a Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:32:52 +0100 Subject: [PATCH 09/31] Update ids.tbl Signed-off-by: mipa83 --- src/ids.tbl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ids.tbl b/src/ids.tbl index fb5c1529d..8b06cd05e 100644 --- a/src/ids.tbl +++ b/src/ids.tbl @@ -1393,6 +1393,7 @@ CMD(UIUp) CMD(UIDown) CMD(UIBackspace) CMD(UIDelete) +CMD(UINewLine) CMD(EditorSelect) CMD(EditorWordLeft) From 948547a2ea7623aaf9e8affc8858473153b5f1d3 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:33:15 +0100 Subject: [PATCH 10/31] Update ids.tbl: add UINewLine Signed-off-by: mipa83 From 4c45d090be8069fadb4762cf1095511a7ea91b1e Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:35:53 +0100 Subject: [PATCH 11/31] Update user_interface.cc: changed load_keymap (// comments /n) Signed-off-by: mipa83 --- src/user_interface.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/user_interface.cc b/src/user_interface.cc index 3a96c443b..07fbc01ad 100644 --- a/src/user_interface.cc +++ b/src/user_interface.cc @@ -5473,8 +5473,7 @@ bool user_interface::load_keymap(cstring name) bool quoted = false; list_g result; unicode c; - unicode d = ' '; - bool e = false; + unicode d = ' '; while (kmap.valid()) { c = d; From d176dc5c58e1213f7ac2d3b0f645ec854a5e2406 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 28 Jan 2026 09:36:44 +0100 Subject: [PATCH 12/31] Update user_interface.h: add do_new_line() Signed-off-by: mipa83 From eea6aa8ce59d63cc8477f56bcce3d74c2502855e Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 4 Feb 2026 08:47:56 +0100 Subject: [PATCH 13/31] Replace UILowercase with UINoAlpha in db48x.48k MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comments need to start with “//”, ending with “\n” (newline). Signed-off-by: mipa83 --- config/db48x.48k | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/db48x.48k b/config/db48x.48k index afcac37ef..7c57284b2 100644 --- a/config/db48x.48k +++ b/config/db48x.48k @@ -72,7 +72,7 @@ UIExit ": :" "," " " Catalog [ "Σ" "^" "√" "∂" "ρ" "(" "▶" "%" "π" "<" "=" ">" -UILowercase "⇄" "±" "∡" UIDelete +UINoAlpha "⇄" "±" "∡" UIDelete UILeft "7" "8" "9" "÷" UIRight "4" "5" "6" "×" UIRightShift "1" "2" "3" "-" From e9da7a9c28969b91964554dccd7ad2484b3bd4e6 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 4 Feb 2026 09:49:58 +0100 Subject: [PATCH 14/31] Delete config/42style.48k because uses the same image background as db48.48k Signed-off-by: mipa83 --- config/42style.48k | 100 --------------------------------------------- 1 file changed, 100 deletions(-) delete mode 100644 config/42style.48k diff --git a/config/42style.48k b/config/42style.48k deleted file mode 100644 index a6131783b..000000000 --- a/config/42style.48k +++ /dev/null @@ -1,100 +0,0 @@ -@ PLANE 0: UNSHIFTED -[ -ToolsMenu inv sqrt log10 ln UIAlgebraic -Store ToggleCustomMenu StackMenu sin cos tan -Duplicate Swap neg Cycle Drop -StackEditor "7" "8" "9" / -Edit "4" "5" "6" * -UILeftShift "1" "2" "3" - -UIExit "0" UIDecimal Run + -] - -@ PLANE 1: LEFT SHIFTED -[ -LastMenu pow sq exp10 exp LoopsMenu -ComplexMenu FractionsMenu ConstantsMenu asin acos atan -UIAlpha LastArg ModesMenu DisplayModesMenu ClearThingsMenu -EditorHistory SolverMenu IntegrationMenu "[ ]" StatisticsMenu -EditMenu BasesMenu UnitsMenu FlagsMenu ProbabilitiesMenu -UIRightShift ToDecimal ToggleUserMode ProgramMenu ListMenu -OffWithImage SystemSetup Show "« »" Catalog -] - -@ PLANE 2: RIGHT SHIFTED -[ -MainMenu xroot PolynomialsMenu PowersMenu PartsMenu EquationsMenu -MemoryMenu Library MathMenu HyperbolicMenu CircularMenu RealMenu -UIText Undo ObjectMenu PlotMenu UpDir -EditorHistory SymbolicMenu DifferentiationMenu MatrixMenu FinanceSolverMenu -EditMenu TextMenu UnitsConversionsMenu TimeMenu NumbersMenu -UINoShift DebugMenu CharactersMenu TestsMenu IOMenu -SaveState FilesMenu GraphicsMenu "{ }" Help -] - -@ PLANE 3: ALPHA UNSHIFTED -[ -"A" "B" "C" "D" "E" "F" -"G" "H" "I" "J" "K" "L" -UIEnter "M" "N" "O" UIBackspace -UILeft "P" "Q" "R" "S" -UIRight "T" "U" "V" "W" -UILeftShift "X" "Y" "Z" "_" -UIExit ": :" "," " " ";" -] - -@ PLANE 4: ALPHA LEFT SHIFTED -[ -"Σ" "^" "√" "∂" "ρ" "(" -"▶" "%" "π" "<" "=" ">" -UILowercase "⇄" "±" "∡" UIDelete -UILeft "7" "8" "9" "÷" -UIRight "4" "5" "6" "×" -UIRightShift "1" "2" "3" "-" -OffWithImage "0" "." "« »" "+" -] - -@ PLANE 5: ALPHA RIGHT SHIFTED -[ -"∏" "∆" "↑" "μ" "θ" "\" -"→" "←" "↓" "≤" "≠" "≥" -"""" "~" "°" "ε" " -" -UIUp "?" "∫" "[" "/" -UIDown "#" "∞" "|" "*" -UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!' -] - -@ PLANE 6: LOWERCASE UNSHIFTED -[ -"a" "b" "c" "d" "e" "f" -"g" "h" "i" "j" "k" "l" -UIEnter "m" "n" "o" UIBackspace -UILeft "p" "q" "r" "s" -UIRight "t" "u" "v" "w" -UILeftShift "x" "y" "z" "_" -UIExit ": :" "," " " ";" -] - -@ PLANE 7: LOWERCASE LEFT SHIFTED -[ -"A" "B" "C" "D" "E" "F" -"G" "H" "I" "J" "K" "L" -UINoAlpha "M" "N" "O" UIDelete -UILeft "P" "Q" "R" "S" -UIRight "T" "U" "V" "W" -UIRightShift "X" "Y" "Z" "_" -OffWithImage ": :" "," ";" "?" -] - -@ PLANE 8: LOWERCASE RIGHT SHIFTED -[ -"α" "β" "γ" "δ" "ε" "φ" -"Γ" "θ" "Δ" "λ" "λ" "ν" -UINoAlpha "Π" "Σ" "ω" " -" -UIUp "?" "∫" "[" "/" -UIDown "#" "∞" "|" "*" -UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!" -] From 124b5b956d22f0913a7ec0fa99732ebea25e0eb5 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 4 Feb 2026 16:12:21 +0100 Subject: [PATCH 15/31] Delete config/true42.48k Signed-off-by: mipa83 --- config/true42.48k | 100 ---------------------------------------------- 1 file changed, 100 deletions(-) delete mode 100644 config/true42.48k diff --git a/config/true42.48k b/config/true42.48k deleted file mode 100644 index 29786f977..000000000 --- a/config/true42.48k +++ /dev/null @@ -1,100 +0,0 @@ -@ PLANE 0: UNSHIFTED -[ -ToolsMenu inv sqrt log10 ln UIAlgebraic -Store ToggleCustomMenu StackMenu sin cos tan -Duplicate Swap neg Cycle Drop -StackEditor "7" "8" "9" / -Edit "4" "5" "6" * -UILeftShift "1" "2" "3" - -UIExit "0" UIDecimal Run + -] - -@ PLANE 1: LEFT SHIFTED -[ -LastMenu pow sq exp10 exp LoopsMenu -ComplexMenu FractionsMenu ConstantsMenu asin acos atan -UIAlpha LastArg ModesMenu DisplayModesMenu ClearThingsMenu -EditorHistory SolverMenu IntegrationMenu "[ ]" StatisticsMenu -EditMenu BasesMenu UnitsMenu FlagsMenu ProbabilitiesMenu -UIRightShift ToDecimal ToggleUserMode ProgramMenu ListMenu -Off SystemSetup Show "« »" Catalog -] - -@ PLANE 2: RIGHT SHIFTED -[ -MainMenu xroot PolynomialsMenu PowersMenu PartsMenu EquationsMenu -MemoryMenu Library MathMenu HyperbolicMenu CircularMenu RealMenu -UIText Undo ObjectMenu PlotMenu UpDir -EditorHistory SymbolicMenu DifferentiationMenu MatrixMenu FinanceSolverMenu -EditMenu TextMenu UnitsConversionsMenu TimeMenu NumbersMenu -UINoShift DebugMenu CharactersMenu TestsMenu IOMenu -SaveState FilesMenu GraphicsMenu "{ }" Help -] - -@ PLANE 3: ALPHA UNSHIFTED -[ -"A" "B" "C" "D" "E" "F" -"G" "H" "I" "J" "K" "L" -UIEnter "M" "N" "O" UIBackspace -UILeft "P" "Q" "R" "S" -UIRight "T" "U" "V" "W" -UILeftShift "X" "Y" "Z" "_" -UIExit ": :" "," " " ";" -] - -@ PLANE 4: ALPHA LEFT SHIFTED -[ -"Σ" "^" "√" "∂" "ρ" "(" -"▶" "%" "π" "<" "=" ">" -UILowercase "⇄" "±" "∡" UIDelete -UILeft "7" "8" "9" "÷" -UIRight "4" "5" "6" "×" -UIRightShift "1" "2" "3" "-" -OffWithImage "0" "." "« »" "+" -] - -@ PLANE 5: ALPHA RIGHT SHIFTED -[ -"∏" "∆" "↑" "μ" "θ" "\" -"→" "←" "↓" "≤" "≠" "≥" -"""" "~" "°" "ε" " -" -UIUp "?" "∫" "[" "/" -UIDown "#" "∞" "|" "*" -UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!' -] - -@ PLANE 6: LOWERCASE UNSHIFTED -[ -"a" "b" "c" "d" "e" "f" -"g" "h" "i" "j" "k" "l" -UIEnter "m" "n" "o" UIBackspace -UILeft "p" "q" "r" "s" -UIRight "t" "u" "v" "w" -UILeftShift "x" "y" "z" "_" -UIExit ": :" "," " " ";" -] - -@ PLANE 7: LOWERCASE LEFT SHIFTED -[ -"A" "B" "C" "D" "E" "F" -"G" "H" "I" "J" "K" "L" -UINoAlpha "M" "N" "O" UIDelete -UILeft "P" "Q" "R" "S" -UIRight "T" "U" "V" "W" -UIRightShift "X" "Y" "Z" "_" -OffWithImage ": :" "," ";" "?" -] - -@ PLANE 8: LOWERCASE RIGHT SHIFTED -[ -"α" "β" "γ" "δ" "ε" "φ" -"Γ" "θ" "Δ" "λ" "λ" "ν" -UINoAlpha "Π" "Σ" "ω" " -" -UIUp "?" "∫" "[" "/" -UIDown "#" "∞" "|" "*" -UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!" -] From a9ccd65248e1b8fd11c8590957cdd3c5bc3fbf35 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 4 Feb 2026 16:14:03 +0100 Subject: [PATCH 16/31] Update user_interface.h Signed-off-by: mipa83 --- src/user_interface.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/user_interface.h b/src/user_interface.h index 777835aff..39c77cd1f 100644 --- a/src/user_interface.h +++ b/src/user_interface.h @@ -88,7 +88,7 @@ struct user_interface using coord = blitter::coord; using size = blitter::size; using rect = blitter::rect; - + bool key(int key, bool repeating, bool transalpha); bool repeating() { return repeat; } object_p assign(int keyid, object_p code); @@ -178,7 +178,7 @@ struct user_interface void clear_shift() { xshift = shift = false; } void clear_help(); void clear_menu(); - object_p object_for_key(int key); + object_p object_for_key(int key, uint plane, uint alpha_plane); int evaluating_function_key() const; bool end_edit(); void clear_editor(); @@ -243,11 +243,12 @@ struct user_interface bool handle_help(int &key); bool handle_editing(int key); bool handle_editing_command(object::id lower, object::id higher); - bool handle_alpha(int key); + bool handle_search(int key); bool handle_user(int key); bool handle_functions(int key); bool handle_functions(int key, object_p obj, bool user); - bool handle_digits(int key); + bool handle_BASED(int key); + bool handle_CHS_EEX(int key); bool noHelpForKey(int key); bool do_search(unicode with = 0, bool restart = false); From d27f186679daa0c665a98e89414ca869dd07050e Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 4 Feb 2026 16:15:19 +0100 Subject: [PATCH 17/31] Refactor key handling in user_interface Refactor user interface key handling functions and improve code clarity. Signed-off-by: mipa83 --- src/user_interface.cc | 511 ++++++++++-------------------------------- 1 file changed, 114 insertions(+), 397 deletions(-) diff --git a/src/user_interface.cc b/src/user_interface.cc index 07fbc01ad..0ec588971 100644 --- a/src/user_interface.cc +++ b/src/user_interface.cc @@ -658,18 +658,20 @@ bool user_interface::key(int key, bool repeating, bool talpha) } } - // Handle keys bool result = handle_shifts(key, talpha) || handle_help(key) || + handle_search(key) || + handle_editing(key) || + handle_BASED(key) || + handle_CHS_EEX(key) || handle_user(key) || - handle_editing(key) || - //handle_alpha(key) || //TO-DO - //handle_digits(key) || //TO-DO handle_functions(key) || key == 0; + + menu_refresh(object::ID_Catalog, true); - if (rt.editing()) + if (rt.editing()) update_mode(); if (!skey && last != KEY_SHIFT) @@ -1169,7 +1171,7 @@ bool user_interface::replace_character_left_of_cursor(unicode code) bool user_interface::replace_character_left_of_cursor(symbol_p sym) // ---------------------------------------------------------------------------- -// Replace the character left of cursor with teh symbol +// Replace the character left of cursor with the symbol // ---------------------------------------------------------------------------- { size_t len = 0; @@ -4159,7 +4161,7 @@ bool user_interface::handle_help(int &key) // Handle help keys when showing help // ---------------------------------------------------------------------------- { - if (!showing_help()) + if (!showing_help()) { // Exit if we are editing or entering digits if (last == KEY_SHIFT || Stack.interactive) @@ -4174,7 +4176,18 @@ bool user_interface::handle_help(int &key) record(help, "Looking for help topic for key %d, long = %d shift=%d\n", key, longpress, shift_plane()); - if (object_p obj = object_for_key(key)) + uint kc = platform_keyid(key, + shift, xshift, + alpha, lowercase, transalpha); + object_p obj; + bool objOk = false; + if (Settings.UserMode()) + { + if (obj= assigned(kc)) objOk = true; + } + if (!objOk) + if ( obj = object_for_key(key,shift_plane(),alpha_plane())) objOk = true; + if (objOk) { record(help, "Looking for help topic for key %d\n", key); save seval(evaluating, key); @@ -4772,12 +4785,6 @@ bool user_interface::handle_editing(int key) last = 0; return true; } - else if (xshift) - { - insert('{', PROGRAM); - last = 0; - return true; - } else if (isEditing) { // Stick to space role while editing, do not EVAL, repeat @@ -4792,15 +4799,6 @@ bool user_interface::handle_editing(int key) } break; - case KEY_9: - if (shift) - { - // Shift-9 enters a matrix - insert('[', MATRIX); - last = 0; - return true; - } - break; } } @@ -4829,12 +4827,12 @@ bool user_interface::handle_editing(int key) if (isEditing) { - record(user_interface, "Editing key %d", key); + record(user_interface, "Editing key %d", key); switch (key) { - case KEY_BSP: - if (xshift) - return false; + case KEY_BSP: + if (xshift) + return do_new_line(); return do_delete(shift); case KEY_ENTER: { @@ -4847,7 +4845,6 @@ bool user_interface::handle_editing(int key) // Clear error if there is one, else clear editor if (shift || xshift) return false; - return do_exit(); case KEY_UP: @@ -4944,131 +4941,84 @@ bool user_interface::handle_editing_command(object::id lo, object::id hi) } -bool user_interface::handle_alpha(int key) +bool user_interface::handle_search(int key) // ---------------------------------------------------------------------------- -// Handle alphabetic user_interface +// Handle keys in search mode // ---------------------------------------------------------------------------- { - // Things that we never handle in alpha mode - if (!key || (key >= KEY_F1 && key <= KEY_F6) || key == KEY_EXIT) - return false; - - // Allow "alpha" mode for keys A-F in based number mode - // xshift-ENTER inserts quotes, xshift-BSP inserts \n - bool editing = rt.editing(); - bool hex = editing && !alpha && mode == BASED && key >= KB_A && key <= KB_F; - bool special = xshift && (key == KEY_ENTER || (key == KEY_BSP && editing)); - if (!alpha && !hex && !special) - return false; - - static const char upper[] = - "ABCDEF" - "GHIJKL" - "_MNO_" - "_PQRS" - "_TUVW" - "_XYZ_" - "_:, ;"; - static const char lower[] = - "abcdef" - "ghijkl" - "_mno_" - "_pqrs" - "_tuvw" - "_xyz_" - "_:, ;"; - - static const unicode shifted[] = - { - L'Σ', '^', L'√', L'∂', L'σ', '(', - L'▶', '%', L'π', '<', '=', '>', - '_', L'⇄', L'±', L'∡', '_', - '_', '7', '8', '9', L'÷', - '_', '4', '5', '6', L'×', - '_', '1', '2', '3', '-', - '_', '0', '.', L'«', '+' - }; - - static const unicode xshifted[] = - { - L'∏', L'∆', L'↑', L'μ', L'θ', '\'', - L'→', L'←', L'↓', L'≤', L'≠', L'≥', - '"', '~', L'°', L'ε', '\n', - '_', '?', L'∫', '[', '/', - '_', '#', L'∞', '|' , '*', - '_', '&', '@', '$', L'…', - '_', ';', L'·', '{', '!' - }; - - // Special case: + in alpha mode shows the catalog - if (key == KEY_ADD && !shift && !xshift) - { - object_p cat = command::static_object(menu::ID_Catalog); - cat->evaluate(); - return true; - } - - key--; - unicode c = - hex ? upper[key] : - xshift ? xshifted[key] : - shift ? shifted[key] : - lowercase ? lower[key] : - upper[key]; - if (~searching) - { - if (!do_search(c)) - beep(2400, 100); - } - else - { - if (menu_p m = menu()) + if (!key || !~searching) + return false; + if (key == KEY_F4) // to SEARCH next + return false; + switch (key) { - menu::id mid = m->type(); - if (mid >= menu::ID_CharactersMenu00 && - mid <= menu::ID_CharactersMenu99) - { - character_menu_p cm = character_menu_p(m); - if (cm->transliterate(c)) - { - size_t edlen = rt.editing(); - utf8 ed = rt.editor(); - if (ed && edlen) - { - uint ppos = utf8_previous(ed, cursor); - if (ppos != cursor) - remove(ppos, cursor - ppos); - } - } - } + case KEY_BSP: + return do_delete(shift); + case KEY_ENTER: + return do_enter(); + case KEY_EXIT: + return do_enter(); } - insert(c, DIRECT); - if (c == '"') - alpha = true; - repeat = true; - menu_refresh(object::ID_Catalog, true); - } - return true; + unicode c = '_'; + uint kc = platform_keyid(key, + shift, xshift, + alpha, lowercase, transalpha); + object_p obj; + bool objOk = false; + if (Settings.UserMode()) + { + if (obj= assigned(kc)) objOk = true; + } + if (!objOk) + if ( obj = object_for_key(key,shift_plane(),alpha_plane())) objOk = true; + if (objOk) + { + if (text_p direct = obj->as()) + { + size_t sz = 0; + utf8 txt = direct->value(&sz); + if (sz == 1) // use, if only one size large + { + c = direct->value(&sz)[0]; + } + } + } + if (!do_search(c)) + { + beep(2400, 100); + } + return true; } -bool user_interface::handle_digits(int key) +bool user_interface::handle_BASED(int key) // ---------------------------------------------------------------------------- -// Handle alphabetic user_interface +// Handle insert of based numbers (A-F) +// ---------------------------------------------------------------------------- +{ + if (!key || mode != BASED) + return false; + if (key >= KB_A && key <= KB_F) + { + uint plane = 0; + uint alpha_plane = 1; + record(user_interface, + "Handle function for key %d (plane %d) ", key, plane); + if (object_p obj = object_for_key(key,plane,alpha_plane)) + return handle_functions(key, obj, false); + } + return false; +} + + +bool user_interface::handle_CHS_EEX(int key) +// ---------------------------------------------------------------------------- +// Handle change sign +/- and enter exponent EEX: prefix cylce mode with units // ---------------------------------------------------------------------------- { if (alpha || shift || xshift || !key) return false; - static const char numbers[] = - "______" - "______" - "__-__" - "_789_" - "_456_" - "_123_" - "_0.__"; - if (rt.editing()) { if (key == KEY_CHS) @@ -5223,236 +5173,10 @@ bool user_interface::handle_digits(int key) } } - if (key > KEY_CHS && key < KEY_F1) - { - unicode c = numbers[key - 1]; - if (~searching) - { - bool found = false; - switch (key) - { - case KEY_ADD: found = do_search('+'); break; - case KEY_SUB: found = do_search('-'); break; - case KEY_MUL: found = do_search('*')||do_search(L'×') - ||do_search(L'·'); break; - case KEY_DIV: found = do_search('/')||do_search(L'÷'); break; - case KEY_DOT: found = do_search('.')||do_search(L','); break; - case KEY_E: found = do_search('E')||do_search(L'⁳'); break; - default: - if (c == '_') - return false; - found = do_search(c); - break; - } - if (!found) - beep(2400, 100); - return true; - } - if (c == '_') - return false; - if (c == '.' && mode != TEXT) - return do_decimal_separator(); - insert(c, DIRECT); - repeat = true; - return true; - } return false; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool user_interface::load_keymap(cstring name) // ---------------------------------------------------------------------------- // Load the keymap from a file @@ -5548,13 +5272,12 @@ bool user_interface::load_keymap(cstring name) } -object_p user_interface::object_for_key(int key) +object_p user_interface::object_for_key(int key,uint plane, uint alpha_plane) // ---------------------------------------------------------------------------- // Return the object for a given key // ---------------------------------------------------------------------------- { - object_p obj = nullptr; - uint plane = shift_plane(); + object_p obj = nullptr; if (key >= KEY_F1 && key <= KEY_F6) { uint fplane = plane < menu_planes() ? plane : 0; @@ -5562,16 +5285,11 @@ object_p user_interface::object_for_key(int key) if (obj) return obj; } - if (keymap && key > 0 && key <= NUM_KEYS) - if (object_p planeobj = keymap->at(plane + NUM_PLANES * alpha_plane())) + if (object_p planeobj = keymap->at(plane + NUM_PLANES * alpha_plane)) if (list_p plane = planeobj->as_array_or_list()) if (object_p keyobj = plane->at(key-1)) - return keyobj; - - - - + return keyobj; return obj; } @@ -5586,7 +5304,7 @@ bool user_interface::handle_functions(int key) record(user_interface, "Handle function for key %d (plane %d) ", key, shift_plane()); - if (object_p obj = object_for_key(key)) + if (object_p obj = object_for_key(key,shift_plane(),alpha_plane())) return handle_functions(key, obj, false); return false; } @@ -5597,14 +5315,14 @@ bool user_interface::handle_user(int key) // Check if we have one of the user-defined functions // ---------------------------------------------------------------------------- { - if (!key || !Settings.UserMode()) + if (!key || !Settings.UserMode()) return false; bool result = false; uint kc = platform_keyid(key, shift, xshift, alpha, lowercase, transalpha); - if (object_p binding = assigned(kc)) +if (object_p binding = assigned(kc)) result = handle_functions(key, binding, true); return result; } @@ -6003,21 +5721,19 @@ bool user_interface::do_delete(bool forward) // Delete what is right of cursor // ---------------------------------------------------------------------------- { - if (~searching) + + if (~searching) { utf8 ed = rt.editor(); if (cursor > select) cursor = utf8_previous(ed, cursor); - else if (~select) + else if (~select) select = utf8_previous(ed, select); - if (cursor == select) - cursor = select = searching; - else - do_search(0, true); + do_search(0, true); } else { - utf8 ed = rt.editor(); + utf8 ed = rt.editor(); size_t edlen = rt.editing(); if (~select && select != cursor) @@ -6064,9 +5780,6 @@ bool user_interface::do_delete(bool forward) menu_refresh(object::ID_Catalog, true); } - // Do not stop editing if we delete last character - if (!rt.editing()) - insert(' ', DIRECT); last = 0; return true; } @@ -6387,24 +6100,29 @@ bool user_interface::do_search(unicode with, bool restart) return false; if (!~select) select = cursor; - - bool forward = cursor >= select; + + bool forward = cursor >= select; size_t selected = forward ? cursor - select : select - cursor; - if (selected > max) + if (selected >= max) { selected = 0; select = cursor; } - size_t found = ~0; + if ((with == 0) && (selected==0)) + { + edRows = 0; + dirtyEditor = true; + return false; + } + size_t found = ~0; uint ref = forward ? select : cursor; uint start = restart ? searching : ref; uint search = start; - - // Skip current location (search next) or not (incremental search) + // Skip current location (search next) or not (incremental search) bool skip = with == 0; - + // Loop until we either find a new spot or we wrap around - for (uint count = 0; !~found && count < max; count++) + for (uint count = 0; !~found && count <= max; count++) { if (skip) { @@ -6454,7 +6172,6 @@ bool user_interface::do_search(unicode with, bool restart) break; } } - if (~found) { if (with) From 88793b7c1d675a538fe2af0a1da4e5060a91d5a4 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 4 Feb 2026 16:18:45 +0100 Subject: [PATCH 18/31] Remove unused keyboard configuration entries Removed unnecessary keyboard configurations from the array. Signed-off-by: mipa83 --- sim/sim-window.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sim/sim-window.cpp b/sim/sim-window.cpp index fe452bb84..c53ea4225 100644 --- a/sim/sim-window.cpp +++ b/sim/sim-window.cpp @@ -556,9 +556,7 @@ void MainWindow::keyPressEvent(QKeyEvent * ev) static cstring keyboards[] = { "config/db48x.48k", - "config/legacy.48k", - "config/42style.48k", - "config/true42.48k", + "config/legacy.48k", }; // HACK - Not thread safe, don't do that while running From c86a31d0f8260fe1e140a28b6f9ba4c9c322b3f6 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Wed, 4 Feb 2026 16:19:29 +0100 Subject: [PATCH 19/31] Remove obsolete image file aliases from sim.qrc Removed obsolete image file aliases from resource. Signed-off-by: mipa83 --- sim/sim.qrc | 3 --- 1 file changed, 3 deletions(-) diff --git a/sim/sim.qrc b/sim/sim.qrc index 20e954e4a..56ea03400 100644 --- a/sim/sim.qrc +++ b/sim/sim.qrc @@ -1,9 +1,6 @@ - keyboard-db48x.png - keyboard-db48x-42like.png keyboard-db48x-old.png keyboard-db48x.png - keyboard-dm42.png From d1fd0cdcc2ce6a40e28022bb04f27c6639c316c8 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Tue, 10 Feb 2026 20:52:50 +0100 Subject: [PATCH 20/31] Update key handling condition in BASED mode Eliminated Bug with BASED mode, by adding enable condition: !rt.editing() Signed-off-by: mipa83 --- src/user_interface.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/user_interface.cc b/src/user_interface.cc index 0ec588971..88f8ee6b3 100644 --- a/src/user_interface.cc +++ b/src/user_interface.cc @@ -4996,7 +4996,7 @@ bool user_interface::handle_BASED(int key) // Handle insert of based numbers (A-F) // ---------------------------------------------------------------------------- { - if (!key || mode != BASED) + if (!key || mode != BASED || !rt.editing()) return false; if (key >= KB_A && key <= KB_F) { @@ -5080,7 +5080,7 @@ bool user_interface::handle_CHS_EEX(int key) dirtyEditor = true; return true; } - else if (key == KEY_E && !~searching) + else if (key == KEY_E) { if (mode == UNIT) { From 226448fa2dcdcfc358eac0902030d51a06521173 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Thu, 19 Feb 2026 12:25:46 +0100 Subject: [PATCH 21/31] Update key mappings in db48x.48k configuration Signed-off-by: mipa83 --- config/db48x.48k | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/config/db48x.48k b/config/db48x.48k index 7c57284b2..7e35bda79 100644 --- a/config/db48x.48k +++ b/config/db48x.48k @@ -1,24 +1,24 @@ -// PLANE 0: UNSHIFTED +// PLANE 1: UNSHIFTED [ ToolsMenu inv sqrt pow MathMenu UIAlgebraic -Store ToggleCustomMenu StackMenu sin cos tan -Duplicate Swap neg Cycle Drop +Store ToggleCustomMenu StackMenu sin cos tan +Duplicate Swap Negate Cycle Drop StackEditor "7" "8" "9" / Edit "4" "5" "6" * UILeftShift "1" "2" "3" - -UIExit "0" UIDecimal Run + +UIExit "0" UIDecimal Run + ] -// PLANE 1: LEFT SHIFTED +// PLANE 2: LEFT SHIFTED [ LastMenu exp sq abs PowersMenu EquationsMenu ComplexMenu MemoryMenu ConstantsMenu asin acos atan UIAlpha LastArg ModesMenu DisplayModesMenu ClearThingsMenu -EditorHistory SolverMenu IntegrationMenu "[ ]" StatisticsMenu +EditorHistory SolverMenu IntegrationMenu "[ ]" StatisticsMenu EditMenu BasesMenu UnitsMenu FlagsMenu ProbabilitiesMenu UIRightShift ToDecimal ToggleUserMode ProgramMenu ListMenu OffWithImage SystemSetup Show "« »" Catalog ] -// PLANE 2: RIGHT SHIFTED +// PLANE 3: RIGHT SHIFTED [ MainMenu ln xroot AlgebraMenu PartsMenu CharactersMenu RealMenu Library FractionsMenu HyperbolicMenu CircularMenu AnglesMenu @@ -28,7 +28,7 @@ EditMenu TextMenu UnitsConversionsMenu TimeMenu NumbersMenu UINoShift DebugMenu LoopsMenu TestsMenu ObjectMenu SaveState FilesMenu GraphicsMenu "{ }" Help ] -// PLANE 3: ALPHA UNSHIFTED +// PLANE 4: ALPHA UNSHIFTED [ "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" @@ -36,11 +36,11 @@ UIEnter "M" "N" "O" UIBackspace UILeft "P" "Q" "R" "S" UIRight "T" "U" "V" "W" UILeftShift "X" "Y" "Z" "_" -UIExit ": :" "," " " Catalog +UIExit ": :" "," Run Catalog ] -// PLANE 4: ALPHA LEFT SHIFTED +// PLANE 5: ALPHA LEFT SHIFTED [ -"Σ" "^" "√" "∂" "ρ" "(" +"Σ" "^" "√" "∂" "ρ" "( )" "▶" "%" "π" "<" "=" ">" UILowercase "⇄" "±" "∡" UIDelete UILeft "7" "8" "9" "÷" @@ -48,17 +48,17 @@ UIRight "4" "5" "6" "×" UIRightShift "1" "2" "3" "-" OffWithImage "0" UIDecimal "« »" "+" ] -// PLANE 5: ALPHA RIGHT SHIFTED +// PLANE 6: ALPHA RIGHT SHIFTED [ -"∏" "∆" "↑" "μ" "θ" "\" +"∏" "∆" "↑" "μ" "θ" "' '" "→" "←" "↓" "≤" "≠" "≥" UIText "~" "°" "ε" UINewLine UIUp "?" "∫" "[" "/" UIDown "#" "∞" "|" "*" UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!" +SaveState ";" "·" "{ }" "!" ] -// PLANE 6: LOWERCASE UNSHIFTED +// PLANE 7: LOWERCASE UNSHIFTED [ "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" @@ -66,11 +66,11 @@ UIEnter "m" "n" "o" UIBackspace UILeft "p" "q" "r" "s" UIRight "t" "u" "v" "w" UILeftShift "x" "y" "z" "_" -UIExit ": :" "," " " Catalog +UIExit ": :" "," Run Catalog ] -// PLANE 7: LOWERCASE LEFT SHIFTED +// PLANE 8: LOWERCASE LEFT SHIFTED [ -"Σ" "^" "√" "∂" "ρ" "(" +"Σ" "^" "√" "∂" "ρ" "( )" "▶" "%" "π" "<" "=" ">" UINoAlpha "⇄" "±" "∡" UIDelete UILeft "7" "8" "9" "÷" @@ -78,13 +78,13 @@ UIRight "4" "5" "6" "×" UIRightShift "1" "2" "3" "-" OffWithImage "0" UIDecimal "« »" "+" ] -// PLANE 8: LOWERCASE RIGHT SHIFTED +// PLANE 9: LOWERCASE RIGHT SHIFTED [ -"α" "β" "γ" "δ" "ε" "φ" -"Γ" "θ" "Δ" "λ" "λ" "ν" -UINoAlpha "Π" "Σ" "ω" UINewLine +"∏" "∆" "↑" "μ" "θ" "' '" +"→" "←" "↓" "≤" "≠" "≥" +UIText "~" "°" "ε" UINewLine UIUp "?" "∫" "[" "/" UIDown "#" "∞" "|" "*" UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!" +SaveState ";" "·" "{ }" "!" ] From 9a461fa0b92cc3ece10598855a8a471049f90a50 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Thu, 26 Feb 2026 09:26:16 +0100 Subject: [PATCH 22/31] Fix key mappings and command references in db48x.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated key mappings for simulator (hold Shift key ⇧, hold Alt key ⎇ ) and corrected references for LastArg and Undo commands. Signed-off-by: mipa83 --- help/db48x.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/help/db48x.md b/help/db48x.md index 0b70e8c41..d74ba482d 100644 --- a/help/db48x.md +++ b/help/db48x.md @@ -140,6 +140,11 @@ There are three ways to enter *Alpha* mode: as soon as the arrow key is released. Using _◀︎_ enters uppercase characters, while _▶︎_ uses lowercase characters. + Simulator: + hold Shift key ⇧ istead of _◀︎_, + hold Alt key ⎇ istead of _▶︎_ + + There is no equivalent of the HP48's "single-Alpha" mode. Alpha mode is either _transient_ (when you hold one of the arrow keys) or _sticky_ (with 🟨 _ENTER_ or by holding 🟨). @@ -1600,12 +1605,11 @@ Use _Drop_ (_EXIT_) to remove the top value from the stack. This helps keep the ### LastArg to recall last arguments -Use _LastArg_ (🟦 _ENTER_) to recall the arguments of the last operation. This is useful when you want to repeat a calculation with different parameters. +Use _LastArg_ (🟨 _M_) to recall the arguments of the last operation. This is useful when you want to repeat a calculation with different parameters. ### Undo to restore previous stack state -Use _Undo_ (🟦 _EXIT_) to restore the stack to its previous state. This is invaluable for recovering from mistakes or exploring different calculation paths. - +Use _Undo_ (🟦 _M_) to restore the stack to its previous state. This is invaluable for recovering from mistakes or exploring different calculation paths. ## The command line From 8e1d4c41edcae7872f2e3d7eb908db2f6cf8898d Mon Sep 17 00:00:00 2001 From: mipa83 Date: Thu, 26 Feb 2026 19:56:38 +0100 Subject: [PATCH 23/31] load all functions from keymap file, improvesd search mode Signed-off-by: mipa83 --- src/user_interface.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/user_interface.h b/src/user_interface.h index 39c77cd1f..41aedb5f2 100644 --- a/src/user_interface.h +++ b/src/user_interface.h @@ -88,7 +88,7 @@ struct user_interface using coord = blitter::coord; using size = blitter::size; using rect = blitter::rect; - + bool key(int key, bool repeating, bool transalpha); bool repeating() { return repeat; } object_p assign(int keyid, object_p code); @@ -212,6 +212,9 @@ struct user_interface bool do_down(); bool do_delete(bool forward); bool do_new_line(); + bool editing_chs(); + bool editing_eex_or_cycle_prefixes(); + bool editing_spc_equal_semicolon(); text_p editor_save(text_r ed, bool rewinding = false); text_p editor_save(bool rewinding = false); @@ -247,8 +250,7 @@ struct user_interface bool handle_user(int key); bool handle_functions(int key); bool handle_functions(int key, object_p obj, bool user); - bool handle_BASED(int key); - bool handle_CHS_EEX(int key); + bool handle_based(int key); bool noHelpForKey(int key); bool do_search(unicode with = 0, bool restart = false); From 323189e69f42859bdae422e49e84cfb67f60a5dd Mon Sep 17 00:00:00 2001 From: mipa83 Date: Thu, 26 Feb 2026 20:25:02 +0100 Subject: [PATCH 24/31] load all plants from keymap file, improved search mode: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit changed keymap file and loading criteria: skip comments (//) till newline arrives. Integrated the behaviour of Key_CHS, Key_RUN, Key_E in function handle_editing(key). created functions (called them “editing”, because they work in editing mode): editing_chs(), editing_eex_or_cycle_prefixes(), editing_spc_equal_semicolon(). CHS: changes -to +: example: ‘5-3 CHS  5+3 (old was ‘53’) EEX: check if there is already an exponent, so beep and move there, otherwise exponent with or without leading 1. spc_equal_semicolon() works now also with alpha and lowercase. CAT working in alpha and lowercase mode Annunciator line/Header: I got confused with alpha, lowercase and user mode: so I rewrote the labelling: static cstring lbls[] = { " ", " A", " a", "U ", "UA", "Ua", "1 ", "1A", "1a", }; Commands are shown now also in editing mode: example: Dark “cos” holding COS is shown now also while editing…; Dark “cos” disappears when releasing the key. SEARCH improvements: “DROP” and “DEL” reduces the selection from right and left. “LEFT” and “RIGHT” reduce or expand the selection 10^x (EEX): works with search Signed-off-by: mipa83 --- src/user_interface.cc | 1091 +++++++++++++++++++++++++++-------------- 1 file changed, 729 insertions(+), 362 deletions(-) diff --git a/src/user_interface.cc b/src/user_interface.cc index 88f8ee6b3..c1e43f4cb 100644 --- a/src/user_interface.cc +++ b/src/user_interface.cc @@ -658,17 +658,18 @@ bool user_interface::key(int key, bool repeating, bool talpha) } } + bool result = handle_shifts(key, talpha) || handle_help(key) || handle_search(key) || - handle_editing(key) || - handle_BASED(key) || - handle_CHS_EEX(key) || + handle_editing(key) || + handle_based(key) || + handle_user(key) || handle_functions(key) || key == 0; - + menu_refresh(object::ID_Catalog, true); if (rt.editing()) @@ -2276,12 +2277,15 @@ bool user_interface::draw_annunciators() if (alpha || user) { static cstring lbls[] = { - "", "ABC", "abc", "abc", - "USR", "αUS", "usr", "αus", - "", "ABC", "abc", "abc", - "1US", "α1U", "1us", "α1u" + " ", " A", " a", + "U ", "UA", "Ua", + "1 ", "1A", "1a", + }; - utf8 label = utf8(lbls[alpha + 2*lowercase + 4*user + 8*userOnce]); + uint kc = 1 * alpha + 1 * (lowercase && alpha); + if (user) kc +=3; + if (userOnce) kc +=3; + utf8 label = utf8(lbls[kc]); pattern apat = lowercase ? Settings.LowerAlphaForeground() : Settings.AlphaForeground(); @@ -4176,16 +4180,19 @@ bool user_interface::handle_help(int &key) record(help, "Looking for help topic for key %d, long = %d shift=%d\n", key, longpress, shift_plane()); - uint kc = platform_keyid(key, - shift, xshift, - alpha, lowercase, transalpha); + + + object_p obj; - bool objOk = false; + bool objOk = false; if (Settings.UserMode()) { - if (obj= assigned(kc)) objOk = true; - } - if (!objOk) + uint kc = platform_keyid(key, + shift, xshift, + alpha, lowercase, transalpha); + if (obj= assigned(kc)) objOk = true; + } + if (!objOk) if ( obj = object_for_key(key,shift_plane(),alpha_plane())) objOk = true; if (objOk) { @@ -4194,11 +4201,11 @@ bool user_interface::handle_help(int &key) if (utf8 htopic = obj->help()) { record(help, "Help topic is %s\n", htopic); - if (!rt.editing()) - { - command = htopic; - dirtyCommand = true; - } + + + command = htopic; + dirtyCommand = true; + if (longpress) { rt.command(command::static_object(object::ID_Help)); @@ -4221,8 +4228,11 @@ bool user_interface::handle_help(int &key) else { if (!noHelpForKey(last)) + { key = last; // Time to evaluate - last = 0; + dirtyStack = true; + } + last = 0; } // Help keyboard movements only applies when help is shown @@ -4455,24 +4465,24 @@ bool user_interface::handle_shifts(int &key, bool talpha) } consumed = true; } - else if (shift && key == KEY_ENTER) - { - // Cycle ABC -> abc -> non alpha - if (alpha) - { - if (lowercase) - alpha = lowercase = false; - else - lowercase = true; - } - else - { - alpha = true; - } - consumed = true; - shift = false; - key = last = 0; - } + + + + + + + + + + + + + + + + + + if (key) last = key; @@ -4485,8 +4495,8 @@ bool user_interface::handle_editing(int key) // Some keys always deal with editing // ---------------------------------------------------------------------------- { - bool consumed = false; - size_t isEditing = rt.editing(); + bool editing = rt.editing(); + if (uint interactive = Stack.interactive) { @@ -4763,44 +4773,44 @@ bool user_interface::handle_editing(int key) return true; } - // Some editing keys that do not depend on data entry mode - if (!alpha) - { - switch(key) - { - case KEY_XEQ: - // XEQ is used to enter algebraic / equation objects - if (!shift && !xshift) - if (do_algebraic()) - return true; - break; - case KEY_RUN: - if (shift) - { - // Shift R/S = PRGM enters a program symbol - if (isEditing && (mode == ALGEBRAIC || mode == PARENTHESES)) - insert('=', ALGEBRAIC); - else - insert(L'«', PROGRAM); - last = 0; - return true; - } - else if (isEditing) - { - // Stick to space role while editing, do not EVAL, repeat - if (mode == PARENTHESES) - insert(';', PARENTHESES); - else if (mode == ALGEBRAIC) - insert('=', ALGEBRAIC); - else - insert(' ', PROGRAM); - repeat = true; - return true; - } - break; - - } - } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // Transient alpha editor keys (bring up the editor if needed) switch(key) @@ -4825,22 +4835,22 @@ bool user_interface::handle_editing(int key) EditMenu::ID_EditorClear); } - if (isEditing) + if (editing) { - record(user_interface, "Editing key %d", key); + record(user_interface, "Editing key %d", key); switch (key) { - case KEY_BSP: - if (xshift) + case KEY_BSP: + if (xshift) return do_new_line(); return do_delete(shift); case KEY_ENTER: - { + // Finish editing and parse the result if (!shift && !xshift) return do_enter(); return false; - } + case KEY_EXIT: // Clear error if there is one, else clear editor if (shift || xshift) @@ -4860,56 +4870,68 @@ bool user_interface::handle_editing(int key) if (xshift) return false; return do_right(); - case 0: + case KEY_CHS: + if (!shift && !xshift && !alpha) + return editing_chs(); return false; - } - } - else - { - switch(key) - { - case KEY_ENTER: - if (xshift) - return do_text(); - break; - case KEY_EXIT: - if (shift || xshift) - return false; - alpha = false; - lowercase = false; - if (Settings.ExitClearsMenu()) - clear_menu(); - return true; - case KEY_DOWN: - // Key down to edit last object on stack + case KEY_E: if (!shift && !xshift && !alpha) - if (do_edit()) - return true; - break; - case KEY_UP: - if (xshift) - { - editor_history(); - return true; - } - else if (!shift) - { - if (rt.args(rt.depth())) - { - if (++Stack.interactive > rt.depth()) - Stack.interactive = rt.depth(); - dirtyStack = true; - dirtyMenu = true; - } - return true; - } - break; - + return editing_eex_or_cycle_prefixes(); + return false; + case KEY_RUN: + if (!shift && !xshift) + return editing_spc_equal_semicolon(); + return false; + case 0: + return false; } } - - return consumed; + + + + + + + + + + + return false; + + + + + + + + + + + + + + + + } + + + + + + + + + + + + + + + + + + bool user_interface::handle_editing_command(object::id lo, object::id hi) @@ -4946,52 +4968,95 @@ bool user_interface::handle_search(int key) // Handle keys in search mode // ---------------------------------------------------------------------------- { + if (key >= KEY_F1 && key <= KEY_F6) + return false; if (!key || !~searching) return false; - if (key == KEY_F4) // to SEARCH next - return false; - switch (key) - { - case KEY_BSP: - return do_delete(shift); - case KEY_ENTER: - return do_enter(); - case KEY_EXIT: - return do_enter(); - } - unicode c = '_'; - uint kc = platform_keyid(key, - shift, xshift, - alpha, lowercase, transalpha); + unicode c = 0; + switch (key) + { + case KEY_BSP: + if (xshift) { c='\n'; break; } + return do_delete(shift); + case KEY_ENTER: + if (xshift) { c='\"'; break; } + return false; + case KEY_EXIT: + return do_enter(); + case KEY_UP: + return false; + case KEY_DOWN: + return false; + case KEY_E: + if (!alpha && !shift && !xshift) c=Settings.ExponentSeparator(); + break; + case KEY_DOT: + if (!shift && !xshift) c ='.'; + break; + case KEY_RUN: + if (!shift && !xshift) c =' '; + break; + } + + + + object_p obj; - bool objOk = false; - if (Settings.UserMode()) - { - if (obj= assigned(kc)) objOk = true; - } - if (!objOk) - if ( obj = object_for_key(key,shift_plane(),alpha_plane())) objOk = true; - if (objOk) + bool found = false; + bool objOk = false; + utf8 txt; + if (c == 0) { - if (text_p direct = obj->as()) + if (Settings.UserMode()) { - size_t sz = 0; - utf8 txt = direct->value(&sz); - if (sz == 1) // use, if only one size large + uint kc = platform_keyid(key,shift,xshift,alpha,lowercase,transalpha); + if (obj = assigned(kc)) objOk = true; + } + if (!objOk) + if ( obj = object_for_key(key,shift_plane(),alpha_plane())) objOk = true; + if (objOk) + { + bool usetxt = false; + size_t len = 0; + if (text_p direct = obj->as_text()) + { + + txt = direct->value(&len); + usetxt = true; + } + if (usetxt) { - c = direct->value(&sz)[0]; + c = utf8_codepoint(txt); + found = true; + for(int i=0;i0 && c=='\"') break; + if (found) + if (!do_search(c)) + { + fprintf(stderr,"(beep)"); + found = false; + } + fprintf(stderr,"%c",c); + txt = utf8_next(txt); + c = utf8_codepoint(txt); + } + fprintf(stderr," "); } } } - if (!do_search(c)) + else { - beep(2400, 100); + if (do_search(c)) + found = true; } - return true; + if (!found) + beep(2400, 100); //not found sound + return true; } -bool user_interface::handle_BASED(int key) +bool user_interface::handle_based(int key) // ---------------------------------------------------------------------------- // Handle insert of based numbers (A-F) // ---------------------------------------------------------------------------- @@ -5007,173 +5072,173 @@ bool user_interface::handle_BASED(int key) if (object_p obj = object_for_key(key,plane,alpha_plane)) return handle_functions(key, obj, false); } - return false; -} - - -bool user_interface::handle_CHS_EEX(int key) -// ---------------------------------------------------------------------------- -// Handle change sign +/- and enter exponent EEX: prefix cylce mode with units -// ---------------------------------------------------------------------------- -{ - if (alpha || shift || xshift || !key) - return false; - - if (rt.editing()) - { - if (key == KEY_CHS) - { - // Special case for change of sign - byte *ed = rt.editor(); - byte *p = ed + cursor; - utf8 found = nullptr; - unicode c = utf8_codepoint(p); - unicode dm = Settings.DecimalSeparator(); - unicode ns = Settings.NumberSeparator(); - unicode hs = Settings.BasedSeparator(); - bool had_complex = false; - while (p > ed && !found) - { - p = (byte *) utf8_previous(p); - c = utf8_codepoint(p); - if (c == complex::I_MARK || c == complex::ANGLE_MARK) - { - had_complex = true; - if (c == complex::ANGLE_MARK) - { - found = utf8_next(p); - } - else - { - found = p; - p = (byte *) utf8_previous(p); - c = utf8_codepoint(p); - } - } - else if ((c < '0' || c > '9') && c != dm && c != ns && c != hs) - { - found = utf8_next(p); - } - } - - if (!found) - found = ed; - if (c == 'e' || c == 'E' || c == Settings.ExponentSeparator()) - c = utf8_codepoint(p); - - if (had_complex) - { - if (c == '+' || c == '-') - *p = '+' + '-' - c; - else - insert(found - ed, '-'); - } - else if (c == '-') - { - remove(p - ed, 1); - } - else - { - insert(found - ed, '-'); - } - last = 0; - dirtyEditor = true; - return true; - } - else if (key == KEY_E) - { - if (mode == UNIT) - { - utf8 start = nullptr; - size_t len = 0; - if (current_word(start, len)) - { - byte *ed = rt.editor(); - byte *st = (byte *) start; - bool ins = true; - bool del = false; - utf8 cycle = utf8("kcmμMGTpn"); // Default cycle - size_t cylen = strlen(cstring(cycle)); - if (object_p name = unit::si_prefixes_variable()) - if (object_p si = directory::recall_all(name, false)) - if (text_p txt = si->as()) - cycle = txt->value(&cylen); - - if (len == 3 && st[1] == 'm' && st[2] == 's') - { - if (st[0] == 'd' || st[0] == 'h') - { - cylen = 0; - st[0] = st[0] == 'd' ? 'h' : 'd'; - } - } - - if (cylen) - { - unicode prefix = utf8_codepoint(cycle); - size_t toremove = 1; - if (len > 1) - { - unicode existing = utf8_codepoint(st); - utf8 cyend = cycle + cylen; - ins = true; - while (cycle < cyend) - { - utf8 ncycle = utf8_next(cycle); - if (existing == utf8_codepoint(cycle)) - { - if (ncycle < cyend) - prefix = utf8_codepoint(ncycle); - else - del = true; - toremove = utf8_size(existing); - ins = false; - break; - } - cycle = ncycle; - } - } - - if (del && - size_t(st - ed + 1) < rt.editing() && - is_valid_in_name(start)) - { - remove(st - ed, toremove); - } - else - { - if (!ins && (size_t(st - ed + 1) >= rt.editing() || - !is_valid_in_name(start))) - { - ins = true; - prefix = utf8_codepoint(cycle); - } - if (ins) - { - insert(st - ed, prefix); - } - else - { - remove(st - ed, toremove); - insert(st - ed, prefix); - } - } - } - } - } - else - { - byte buf[4]; - size_t sz = utf8_encode(Settings.ExponentSeparator(), buf); - insert(cursor, buf, sz); - } - last = 0; - dirtyEditor = true; - return true; - - } - } - return false; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return false; } @@ -5202,9 +5267,10 @@ bool user_interface::load_keymap(cstring name) { c = d; d = kmap.get(); - if (c == '/' && d == '/' && !quoted) + if (c == '/' && d == '/' && !quoted) //skip comments (//) till newline arrives. { do { d = kmap.get(); } while (d != '\n'); + d = kmap.get(); continue; } if (c == '"') @@ -5277,7 +5343,18 @@ object_p user_interface::object_for_key(int key,uint plane, uint alpha_plane) // Return the object for a given key // ---------------------------------------------------------------------------- { - object_p obj = nullptr; + object_p obj = nullptr; + if (keymap && key > 0 && key <= NUM_KEYS) + if (object_p planeobj = keymap->at(plane + NUM_PLANES * alpha_plane)) + { + if (list_p plane = planeobj->as_array_or_list()) + { + if (object_p keyobj = plane->at(key-1)) + { + return keyobj; + } + } + } if (key >= KEY_F1 && key <= KEY_F6) { uint fplane = plane < menu_planes() ? plane : 0; @@ -5285,11 +5362,11 @@ object_p user_interface::object_for_key(int key,uint plane, uint alpha_plane) if (obj) return obj; } - if (keymap && key > 0 && key <= NUM_KEYS) - if (object_p planeobj = keymap->at(plane + NUM_PLANES * alpha_plane)) - if (list_p plane = planeobj->as_array_or_list()) - if (object_p keyobj = plane->at(key-1)) - return keyobj; + + + + + return obj; } @@ -5322,7 +5399,7 @@ bool user_interface::handle_user(int key) uint kc = platform_keyid(key, shift, xshift, alpha, lowercase, transalpha); -if (object_p binding = assigned(kc)) + if (object_p binding = assigned(kc)) result = handle_functions(key, binding, true); return result; } @@ -5438,7 +5515,7 @@ bool user_interface::handle_functions(int key, object_p objp, bool user) [[fallthrough]]; default: - if (validate_input) + if (validate_input) goto insert_object; // If we have the editor open, need to close it @@ -5615,6 +5692,13 @@ bool user_interface::do_exit() dirtyEditor = true; dirtyStack = true; } + else + { + alpha = false; + lowercase = false; + if (Settings.ExitClearsMenu()) + clear_menu(); + } } return true; } @@ -5718,18 +5802,31 @@ bool user_interface::do_down() bool user_interface::do_delete(bool forward) // ---------------------------------------------------------------------------- -// Delete what is right of cursor +// Search: reduce selection by one element right/left +// no selection: Delete what is right/left of cursor +// selection: delete selection // ---------------------------------------------------------------------------- { - + if (~searching) { utf8 ed = rt.editor(); - if (cursor > select) - cursor = utf8_previous(ed, cursor); - else if (~select) - select = utf8_previous(ed, select); - do_search(0, true); + if (forward) + { + if (cursor < select) + cursor = utf8_next(ed, cursor); + else if (cursor > select) + select = utf8_next(ed, select); + } + else + { + if (cursor > select) + cursor = utf8_previous(ed, cursor); + else if (cursor < select) + select = utf8_previous(ed, select); + + } + dirtyEditor = true; } else { @@ -5780,6 +5877,9 @@ bool user_interface::do_delete(bool forward) menu_refresh(object::ID_Catalog, true); } + // Do not stop editing if we delete last character + if (!rt.editing()) + insert(' ', DIRECT); last = 0; return true; } @@ -5788,8 +5888,9 @@ bool user_interface::do_new_line() // ---------------------------------------------------------------------------- // Insert New Line // ---------------------------------------------------------------------------- -{ - insert('\n', DIRECT); +{ + insert('\n', DIRECT); + edRows = 0; return true; } @@ -5799,16 +5900,16 @@ bool user_interface::do_algebraic() // Magic key to enter algebraic objects // ---------------------------------------------------------------------------- { - bool editing = rt.editing(); - if (!editing || mode != BASED) - { - bool is_eqn = editing && is_algebraic(mode); + + + + bool is_eqn = rt.editing() && is_algebraic(mode); insert(is_eqn ? '(' : '\'', ALGEBRAIC); last = 0; return true; - } - return false; -} + } + + bool user_interface::do_text() @@ -5818,11 +5919,275 @@ bool user_interface::do_text() { // Insert quotes and begin editing insert('\"', TEXT); - alpha = true; + if (!lowercase) alpha = true; return true; } +bool user_interface::editing_chs() +// ---------------------------------------------------------------------------- +// Magic key to change sign +/- (editing) +// ---------------------------------------------------------------------------- +{ + if (rt.editing()) + { + // Special case for change of sign + byte *ed = rt.editor(); + byte *p = ed + cursor; + utf8 found = nullptr; + unicode c = utf8_codepoint(p); + unicode dm = Settings.DecimalSeparator(); + unicode ns = Settings.NumberSeparator(); + unicode hs = Settings.BasedSeparator(); + bool had_complex = false; + while (p > ed && !found) + { + p = (byte *) utf8_previous(p); + c = utf8_codepoint(p); + if (c == complex::I_MARK || c == complex::ANGLE_MARK) + { + had_complex = true; + if (c == complex::ANGLE_MARK) + { + found = utf8_next(p); + } + else + { + found = p; + p = (byte *) utf8_previous(p); + c = utf8_codepoint(p); + } + } + else if ((c < '0' || c > '9') && c != dm && c != ns && c != hs) + { + found = utf8_next(p); + } + } + + if (!found) + found = ed; + if (c == 'e' || c == 'E' || c == Settings.ExponentSeparator()) + c = utf8_codepoint(p); + if (c == '+' || c == '-') + *p = '+' + '-' - c; + else + insert(found - ed, '-'); + last = 0; + dirtyEditor = true; + return true; + } + return false; +} +bool user_interface::editing_eex_or_cycle_prefixes() +// ---------------------------------------------------------------------------- +// Magic key to EEX enter exponent or cycle trough SI prefixes (units) +// ---------------------------------------------------------------------------- +{ + if (rt.editing()) + { + if (mode == UNIT) + { + utf8 start = nullptr; + size_t len = 0; + if (current_word(start, len)) + { + byte *ed = rt.editor(); + byte *st = (byte *) start; + bool ins = true; + bool del = false; + utf8 cycle = utf8("kcmμMGTpn"); // Default cycle + size_t cylen = strlen(cstring(cycle)); + if (object_p name = unit::si_prefixes_variable()) + if (object_p si = directory::recall_all(name, false)) + if (text_p txt = si->as()) + cycle = txt->value(&cylen); + + if (len == 3 && st[1] == 'm' && st[2] == 's') + { + if (st[0] == 'd' || st[0] == 'h') + { + cylen = 0; + st[0] = st[0] == 'd' ? 'h' : 'd'; + } + } + + if (cylen) + { + unicode prefix = utf8_codepoint(cycle); + size_t toremove = 1; + if (len > 1) + { + unicode existing = utf8_codepoint(st); + utf8 cyend = cycle + cylen; + ins = true; + while (cycle < cyend) + { + utf8 ncycle = utf8_next(cycle); + if (existing == utf8_codepoint(cycle)) + { + if (ncycle < cyend) + prefix = utf8_codepoint(ncycle); + else + del = true; + toremove = utf8_size(existing); + ins = false; + break; + } + cycle = ncycle; + } + } + + if (del && + size_t(st - ed + 1) < rt.editing() && + is_valid_in_name(start)) + { + remove(st - ed, toremove); + } + else + { + if (!ins && (size_t(st - ed + 1) >= rt.editing() || + !is_valid_in_name(start))) + { + ins = true; + prefix = utf8_codepoint(cycle); + } + if (ins) + { + insert(st - ed, prefix); + } + else + { + remove(st - ed, toremove); + insert(st - ed, prefix); + } + } + } + } + } + else + { + + // Special case for EEX + byte *ed = rt.editor(); + byte *p = ed + cursor; + byte cursor_move = 0; + bool firstN = false; + bool firstS = false; + bool secondN = false; + bool secondS = false; + bool thirdN = false; + bool thirdS = false; + bool found = false; + unicode c = utf8_codepoint(p); + unicode dm = Settings.DecimalSeparator(); + unicode ns = Settings.NumberSeparator(); + unicode hs = Settings.BasedSeparator(); + // E --> use old E criteria: 1=0,2=0,3=0 + // E- --> use old E criteria: 1=S,2=0,3=0 + // E8 --> use old E criteria: 1=N,2=0,3=0 + // E-8 --> use old E criteria: 1=N,2=S,3=0 + // E8- --> new E criteria: 1=S,2=N,3=0 + // E-8- --> new E criteria: 1=S,2=N,3=S + // E8-7 --> new E criteria: 1=N,2=S,3=N + // E8-7 --> new E criteria: 1=N,2=S,3=N + while (p > ed) + { + p = (byte *) utf8_previous(p); + c = utf8_codepoint(p); + if (c== '-' || c=='+') + { + if (!firstN && !firstS) firstS=true; + if (firstN) secondS=true; + if (secondN) thirdS=true; + cursor_move++; + continue; + } + if ((c >= '0' && c <= '9') || c == dm || c == ns || c == hs) + { + if (!firstN && !firstS) firstN=true; + if (firstS) secondN=true; + if (secondS) thirdN=true; + cursor_move++; + continue; + } + if (c == 'e' || c == 'E' || c == Settings.ExponentSeparator()) + { + if ((!firstS && !firstN) || (!secondS && !secondN) || (firstN && secondS && !thirdN && !thirdS)) + { + found = true; + beep(2400, 100); + for(int i=0;i jump to end of Number, new E: 8.888887E(c)-8 + // '(c)8.888887E-8 cursor at beginning --> jump to end of Number, use old E: 8.888887E(c)-8 + if(!found) + { + cursor_move = 0; + p = (byte *) ed + cursor; + byte *ende = ed + rt.editing(); + while(p < ende) + { + c = utf8_codepoint(p); + p = (byte *) utf8_next(p); + if ((c >= '0' && c <= '9') || c == dm || c == ns || c == hs) + { + cursor_move++; + cursor = utf8_next(ed, cursor); + continue; + } + if (c == 'e' || c == 'E' || c == Settings.ExponentSeparator()) + { + found = true; + cursor = utf8_next(ed, cursor); + beep(2400, 100); + } + break; + } + } + if (!found) + { + p = (byte *) ed + cursor; + p = (byte *) utf8_previous(p); + c = utf8_codepoint(p); + if (!((c >= '0' && c <= '9') || c == dm || c == ns || c == hs)) + insert(cursor, utf8("1"), 1); + byte buf[4]; + size_t sz = utf8_encode(Settings.ExponentSeparator(), buf); + insert(cursor, buf, sz); + } + } + last = 0; + dirtyEditor = true; + return true; + } + return false; +} +bool user_interface::editing_spc_equal_semicolon() +// ---------------------------------------------------------------------------- +// Magic key to enter space or equal or semicolon +// ---------------------------------------------------------------------------- +{ + if (rt.editing()) + { + if (mode == PARENTHESES) + insert(';', PARENTHESES); + else if (mode == ALGEBRAIC) + insert('=', ALGEBRAIC); + else + insert(' ', PROGRAM); + last = 0; + dirtyEditor = true; + return true; + } + return false; +} + + bool user_interface::do_decimal_separator() // ---------------------------------------------------------------------------- // Behavior of decimal separator key @@ -6100,7 +6465,7 @@ bool user_interface::do_search(unicode with, bool restart) return false; if (!~select) select = cursor; - + bool forward = cursor >= select; size_t selected = forward ? cursor - select : select - cursor; if (selected >= max) @@ -6108,7 +6473,7 @@ bool user_interface::do_search(unicode with, bool restart) selected = 0; select = cursor; } - if ((with == 0) && (selected==0)) + if ((with == 0) && (selected==0)) { edRows = 0; dirtyEditor = true; @@ -6120,7 +6485,7 @@ bool user_interface::do_search(unicode with, bool restart) uint search = start; // Skip current location (search next) or not (incremental search) bool skip = with == 0; - + // Loop until we either find a new spot or we wrap around for (uint count = 0; !~found && count <= max; count++) { @@ -6135,9 +6500,11 @@ bool user_interface::do_search(unicode with, bool restart) } else { - search = utf8_previous(ed, search); + if (search == 0) - search = utf8_previous(ed, max); + search = max; + search = utf8_previous(ed, search); + } } else @@ -6189,7 +6556,7 @@ bool user_interface::do_search(unicode with, bool restart) } edRows = 0; dirtyEditor = true; - return true; + return true; } return false; } From 96f7ae56b4b612be866ede0a9872abb2258d21b3 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Thu, 26 Feb 2026 22:10:50 +0100 Subject: [PATCH 25/31] load all plants from keymap file, improved search mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit load all plants from keymap file, improved search mode: changed keymap file and loading criteria: skip comments (//) till newline arrives. Integrated the behaviour of Key_CHS, Key_RUN, Key_E in function handle_editing(key). created functions (called them “editing”, because they work in editing mode): editing_chs(), editing_eex_or_cycle_prefixes(), editing_spc_equal_semicolon(). CHS: changes -to +: example: ‘5-3 CHS  5+3 (old was ‘53’) EEX: check if there is already an exponent, so beep and move there, otherwise exponent with or without leading 1. spc_equal_semicolon() works now also with alpha and lowercase. CAT working in alpha and lowercase mode Annunciator line/Header: I got confused with alpha, lowercase and user mode: so I rewrote the labelling: static cstring lbls[] = { " ", " A", " a", "U ", "UA", "Ua", "1 ", "1A", "1a", }; Commands are shown now also in editing mode: example: Dark “cos” holding COS is shown now also while editing…; Dark “cos” disappears when releasing the key. SEARCH improvements: “DROP” and “DEL” reduces the selection from right and left. “LEFT” and “RIGHT” reduce or expand the selection 10^x (EEX): works with search Signed-off-by: mipa83 --- src/user_interface.cc | 310 ++---------------------------------------- 1 file changed, 13 insertions(+), 297 deletions(-) diff --git a/src/user_interface.cc b/src/user_interface.cc index c1e43f4cb..e01c2bbf5 100644 --- a/src/user_interface.cc +++ b/src/user_interface.cc @@ -2279,8 +2279,7 @@ bool user_interface::draw_annunciators() static cstring lbls[] = { " ", " A", " a", "U ", "UA", "Ua", - "1 ", "1A", "1a", - + "1 ", "1A", "1a", }; uint kc = 1 * alpha + 1 * (lowercase && alpha); if (user) kc +=3; @@ -4465,25 +4464,6 @@ bool user_interface::handle_shifts(int &key, bool talpha) } consumed = true; } - - - - - - - - - - - - - - - - - - - if (key) last = key; return consumed; @@ -4773,45 +4753,6 @@ bool user_interface::handle_editing(int key) return true; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Transient alpha editor keys (bring up the editor if needed) switch(key) { @@ -4845,25 +4786,21 @@ bool user_interface::handle_editing(int key) return do_new_line(); return do_delete(shift); case KEY_ENTER: - // Finish editing and parse the result if (!shift && !xshift) return do_enter(); return false; - case KEY_EXIT: // Clear error if there is one, else clear editor if (shift || xshift) return false; return do_exit(); - case KEY_UP: if (shift) return do_up(); if (xshift) return editor_history(); return do_left(); - case KEY_DOWN: if (shift) return do_down(); @@ -4885,53 +4822,9 @@ bool user_interface::handle_editing(int key) case 0: return false; } - } - - - - - - - - - - - return false; - - - - - - - - - - - - - - - - + } + return false; } - - - - - - - - - - - - - - - - - - bool user_interface::handle_editing_command(object::id lo, object::id hi) @@ -4996,11 +4889,7 @@ bool user_interface::handle_search(int key) case KEY_RUN: if (!shift && !xshift) c =' '; break; - } - - - - + } object_p obj; bool found = false; bool objOk = false; @@ -5072,173 +4961,7 @@ bool user_interface::handle_based(int key) if (object_p obj = object_for_key(key,plane,alpha_plane)) return handle_functions(key, obj, false); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - return false; + return false; } @@ -5361,12 +5084,7 @@ object_p user_interface::object_for_key(int key,uint plane, uint alpha_plane) obj = function[fplane][key - KEY_F1]; if (obj) return obj; - } - - - - - + } return obj; } @@ -5616,13 +5334,11 @@ bool user_interface::current_word(utf8 &start, size_t &size) } - // ============================================================================ // // User interface commands, which can be invoked from keymap // // ============================================================================ - bool user_interface::do_edit() // ---------------------------------------------------------------------------- // Edit lowest-level on the stack @@ -5807,7 +5523,6 @@ bool user_interface::do_delete(bool forward) // selection: delete selection // ---------------------------------------------------------------------------- { - if (~searching) { utf8 ed = rt.editor(); @@ -5978,6 +5693,8 @@ bool user_interface::editing_chs() } return false; } + + bool user_interface::editing_eex_or_cycle_prefixes() // ---------------------------------------------------------------------------- // Magic key to EEX enter exponent or cycle trough SI prefixes (units) @@ -6036,7 +5753,6 @@ bool user_interface::editing_eex_or_cycle_prefixes() cycle = ncycle; } } - if (del && size_t(st - ed + 1) < rt.editing() && is_valid_in_name(start)) @@ -6167,6 +5883,8 @@ bool user_interface::editing_eex_or_cycle_prefixes() } return false; } + + bool user_interface::editing_spc_equal_semicolon() // ---------------------------------------------------------------------------- // Magic key to enter space or equal or semicolon @@ -6281,13 +5999,11 @@ bool user_interface::do_decimal_separator() } - // ============================================================================ // // Editor menu commands // // ============================================================================ - bool user_interface::editor_select() // ---------------------------------------------------------------------------- // Set selection to current cursor position @@ -6384,6 +6100,7 @@ bool user_interface::editor_word_right() return true; } + bool user_interface::editor_begin() // ---------------------------------------------------------------------------- // Move cursor to beginning of buffer @@ -6499,12 +6216,10 @@ bool user_interface::do_search(unicode with, bool restart) search = 0; } else - { - + { if (search == 0) search = max; search = utf8_previous(ed, search); - } } else @@ -6664,6 +6379,7 @@ size_t user_interface::adjust_cursor(size_t offset, size_t len) return len; } + size_t user_interface::insert(size_t offset, utf8 data, size_t len) // ---------------------------------------------------------------------------- // Insert data in the editor From 4911ae64ac357876a48788cce7e114b9427a6768 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Thu, 26 Feb 2026 22:12:23 +0100 Subject: [PATCH 26/31] Updating key mappings in db48x.48k configuration // comments till newline Signed-off-by: mipa83 --- config/db48x.48k | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/config/db48x.48k b/config/db48x.48k index 7e35bda79..e7ac6e015 100644 --- a/config/db48x.48k +++ b/config/db48x.48k @@ -1,3 +1,7 @@ +// Note: THIS plans show the commands that are executed when NOT in the editing mode. +// Following keys have diffente functino in editing mode: +// KEY_BSP, KEY_ENTER, KEY_EXIT, KEY_UP, KEY_DOWN, KEY_CHS, KEY_E (EEX),KEY_RUN + // PLANE 1: UNSHIFTED [ ToolsMenu inv sqrt pow MathMenu UIAlgebraic @@ -32,9 +36,9 @@ SaveState FilesMenu GraphicsMenu "{ }" Help [ "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" -UIEnter "M" "N" "O" UIBackspace -UILeft "P" "Q" "R" "S" -UIRight "T" "U" "V" "W" +Duplicate "M" "N" "O" "" +StackEditor "P" "Q" "R" "S" +Edit "T" "U" "V" "W" UILeftShift "X" "Y" "Z" "_" UIExit ": :" "," Run Catalog ] @@ -42,9 +46,9 @@ UIExit ": :" "," Run Catalog [ "Σ" "^" "√" "∂" "ρ" "( )" "▶" "%" "π" "<" "=" ">" -UILowercase "⇄" "±" "∡" UIDelete -UILeft "7" "8" "9" "÷" -UIRight "4" "5" "6" "×" +UILowercase "⇄" "±" "∡" "" +EditorHistory "7" "8" "9" "÷" +EditMenu "4" "5" "6" "×" UIRightShift "1" "2" "3" "-" OffWithImage "0" UIDecimal "« »" "+" ] @@ -52,9 +56,9 @@ OffWithImage "0" UIDecimal "« »" "+" [ "∏" "∆" "↑" "μ" "θ" "' '" "→" "←" "↓" "≤" "≠" "≥" -UIText "~" "°" "ε" UINewLine -UIUp "?" "∫" "[" "/" -UIDown "#" "∞" "|" "*" +UIText "~" "°" "ε" "" +EditorHistory "?" "∫" "[" "/" +EditMenu "#" "∞" "|" "*" UINoShift "&" "@" "$" "…" SaveState ";" "·" "{ }" "!" ] @@ -62,9 +66,9 @@ SaveState ";" "·" "{ }" "!" [ "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" -UIEnter "m" "n" "o" UIBackspace -UILeft "p" "q" "r" "s" -UIRight "t" "u" "v" "w" +Duplicate "m" "n" "o" "" +StackEditor "p" "q" "r" "s" +Edit "t" "u" "v" "w" UILeftShift "x" "y" "z" "_" UIExit ": :" "," Run Catalog ] @@ -72,9 +76,9 @@ UIExit ": :" "," Run Catalog [ "Σ" "^" "√" "∂" "ρ" "( )" "▶" "%" "π" "<" "=" ">" -UINoAlpha "⇄" "±" "∡" UIDelete -UILeft "7" "8" "9" "÷" -UIRight "4" "5" "6" "×" +UINoAlpha "⇄" "±" "∡" "" +EditorHistory "7" "8" "9" "÷" +EditMenu "4" "5" "6" "×" UIRightShift "1" "2" "3" "-" OffWithImage "0" UIDecimal "« »" "+" ] @@ -82,9 +86,9 @@ OffWithImage "0" UIDecimal "« »" "+" [ "∏" "∆" "↑" "μ" "θ" "' '" "→" "←" "↓" "≤" "≠" "≥" -UIText "~" "°" "ε" UINewLine -UIUp "?" "∫" "[" "/" -UIDown "#" "∞" "|" "*" -UINoShift "&" "@" "$" "…" -SaveState ";" "·" "{ }" "!" +UIText "~" "°" "ε" "" +EditorHistory "?" "∫" "[" "/" +EditMenu "#" "∞" "|" "*" +UINoShift "&" "@" "$" "…" +SaveState ";" "·" "{ }" "!" ] From 78c7ae7212a17e2a0d591986f7c3a226f6e2e6d4 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Fri, 27 Feb 2026 18:35:10 +0100 Subject: [PATCH 27/31] load all plants from keymap file, improved search mode (changed handle_user before handle_editing) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit changed keymap file and loading criteria: skip comments (//) till newline arrives. Integrated the behaviour of Key_CHS, Key_RUN, Key_E in function handle_editing(key). created functions (called them “editing”, because they work in editing mode): editing_chs(), editing_eex_or_cycle_prefixes(), editing_spc_equal_semicolon(). CHS: changes -to +: example: ‘5-3 CHS  5+3 (old was ‘53’) EEX: check if there is already an exponent, so beep and move there, otherwise exponent with or without leading 1. spc_equal_semicolon() works now also with alpha and lowercase. CAT working in alpha and lowercase mode Annunciator line/Header: I got confused with alpha, lowercase and user mode: so I rewrote the labelling: static cstring lbls[] = { " ", " A", " a", "U ", "UA", "Ua", "1 ", "1A", "1a", }; Commands are shown now also in editing mode: example: Dark “cos” holding COS is shown now also while editing…; Dark “cos” disappears when releasing the key. SEARCH improvements: “DROP” and “DEL” reduces the selection from right and left. “LEFT” and “RIGHT” reduce or expand the selection 10^x (EEX): works with search Signed-off-by: mipa83 --- src/user_interface.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/user_interface.cc b/src/user_interface.cc index e01c2bbf5..7ef777810 100644 --- a/src/user_interface.cc +++ b/src/user_interface.cc @@ -657,21 +657,16 @@ bool user_interface::key(int key, bool repeating, bool talpha) return true; } } - bool result = handle_shifts(key, talpha) || handle_help(key) || handle_search(key) || - handle_editing(key) || - handle_based(key) || - + handle_based(key) || handle_user(key) || + handle_editing(key) || handle_functions(key) || key == 0; - - menu_refresh(object::ID_Catalog, true); - if (rt.editing()) update_mode(); From d1c1a9a91b64a65b03ca50ae560547817a147b64 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Fri, 27 Feb 2026 18:53:10 +0100 Subject: [PATCH 28/31] WSL - Windows: Updated instructions and added cleanup commands Updated instructions for building the DB48X project, including WSL usage and cleanup commands. Signed-off-by: mipa83 --- BUILD.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/BUILD.md b/BUILD.md index e04a8930a..9ae9d77ad 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,4 +1,4 @@ -# Building the DB48X project +grafik# Building the DB48X project The DB48X project can be built in two variants: @@ -112,17 +112,19 @@ Rember your password!!! Run fedora and enter: ```bash +sudo dnf upgrade --refresh sudo dnf install make sudo dnf install arm-none-eabi-gcc arm-none-eabi-gcc-cs-c++ arm-none-eabi-newlib sudo dnf install qt-devel qt6-qtbase-devel qt6-qtdeclarative-devel qt6-qtmultimedia-devel sudo dnf install freetype-devel sudo dnf install rsync +sudo dnf install git sudo dnf upgrade --refresh ``` ## Install and build DB48x -Run fedora and enter: +Run fedora by opening Windows PowerShell and entering wsl. Then : ```bash git clone https://github.com/c3d/db48x.git @@ -140,15 +142,13 @@ need to run it from the top-level directory if you want the built-in help files and the configuration files to be found: ```bash -`./sim/db48x +./sim/db48x ``` DB48x should run now :-) ## Update DB48x -Run fedora and enter: - ```bash cd db48x git pull @@ -162,6 +162,15 @@ Run fedora and enter: git reset --hard HEAD~1 ``` +## Clean up local changes + +```bash +git clean -f +git checkout . +git restore . +``` + + ## Add Shortcut to Windows (Start-Menu): ### DB48x - WSL terminal From a1ae471d04aef95afa232e8cb89f6b0b4462d533 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Fri, 27 Feb 2026 19:13:33 +0100 Subject: [PATCH 29/31] Updated keymaping to correspond to layout (image) Updated key mappings across various planes Signed-off-by: mipa83 --- config/legacy.48k | 94 ++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/config/legacy.48k b/config/legacy.48k index b6dd87cf5..b1eecfbcf 100644 --- a/config/legacy.48k +++ b/config/legacy.48k @@ -1,90 +1,94 @@ -// PLANE 0: UNSHIFTED +// Note: THIS plans show the commands that are executed when NOT in the editing mode. +// Following keys have different functions in editing mode: +// KEY_BSP, KEY_ENTER, KEY_EXIT, KEY_UP, KEY_DOWN, KEY_CHS, KEY_E (EEX),KEY_RUN + +// PLANE 1: UNSHIFTED [ -ToolsMenu inv sqrt log10 ln UIAlgebraic -Store ToggleCustomMenu StackMenu sin cos tan -Duplicate Swap neg Cycle Drop +ToolsMenu inv sqrt log10 ln UIAlgebraic +Store ToggleCustomMenu StackMenu sin cos tan +Duplicate Swap Negate Cycle Drop StackEditor "7" "8" "9" / Edit "4" "5" "6" * UILeftShift "1" "2" "3" - -UIExit "0" UIDecimal Run + +UIExit "0" UIDecimal Run + ] -// PLANE 1: LEFT SHIFTED +// PLANE 2: LEFT SHIFTED [ LastMenu pow sq exp10 exp LoopsMenu ComplexMenu FractionsMenu ConstantsMenu asin acos atan UIAlpha LastArg ModesMenu DisplayModesMenu ClearThingsMenu -EditorHistory SolverMenu IntegrationMenu "[ ]" StatisticsMenu +EditorHistory SolverMenu IntegrationMenu "[ ]" StatisticsMenu EditMenu BasesMenu UnitsMenu FlagsMenu ProbabilitiesMenu UIRightShift ToDecimal ToggleUserMode ProgramMenu ListMenu OffWithImage SystemSetup Show "« »" Catalog ] -// PLANE 2: RIGHT SHIFTED +// PLANE 3: RIGHT SHIFTED [ MainMenu xroot PolynomialsMenu PowersMenu PartsMenu EquationsMenu MemoryMenu Library MathMenu HyperbolicMenu CircularMenu RealMenu UIText Undo ObjectMenu PlotMenu UpDir -EditorHistory SymbolicMenu DifferentiationMenu MatrixMenu FinanceSolverMenu +EditorHistory SymbolicMenu DifferentiationMenu MatrixMenu FinanceSolverMenu EditMenu TextMenu UnitsConversionsMenu TimeMenu NumbersMenu UINoShift DebugMenu CharactersMenu TestsMenu IOMenu SaveState FilesMenu GraphicsMenu "{ }" Help ] -// PLANE 3: ALPHA UNSHIFTED +// PLANE 4: ALPHA UNSHIFTED [ "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" -UIEnter "M" "N" "O" UIBackspace -UILeft "P" "Q" "R" "S" -UIRight "T" "U" "V" "W" +Duplicate "M" "N" "O" "" +StackEditor "P" "Q" "R" "S" +Edit "T" "U" "V" "W" UILeftShift "X" "Y" "Z" "_" -UIExit ": :" "," " " Catalog +UIExit ": :" "," Run Catalog ] -// PLANE 4: ALPHA LEFT SHIFTED +// PLANE 5: ALPHA LEFT SHIFTED [ -"Σ" "^" "√" "∂" "ρ" "(" +"Σ" "^" "√" "∂" "ρ" "( )" "▶" "%" "π" "<" "=" ">" -UILowercase "⇄" "±" "∡" UIDelete -UILeft "7" "8" "9" "÷" -UIRight "4" "5" "6" "×" -UIRightShift "1" "2" "3" "-" -OffWithImage "0" UIDecimal "« »" "+" +UILowercase "⇄" "±" "∡" "" +EditorHistory "7" "8" "9" "÷" +EditMenu "4" "5" "6" "×" +UIRightShift "1" "2" "3" "-" +OffWithImage "0" UIDecimal "« »" "+" ] -// PLANE 5: ALPHA RIGHT SHIFTED +// PLANE 6: ALPHA RIGHT SHIFTED [ -"∏" "∆" "↑" "μ" "θ" "\" +"∏" "∆" "↑" "μ" "θ" "' '" "→" "←" "↓" "≤" "≠" "≥" -UIText "~" "°" "ε" UINewLine -UIUp "?" "∫" "[" "/" -UIDown "#" "∞" "|" "*" +UIText "~" "°" "ε" "" +EditorHistory "?" "∫" "[" "/" +EditMenu "#" "∞" "|" "*" UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!" +SaveState ";" "·" "{ }" "!" ] -// PLANE 6: LOWERCASE UNSHIFTED +// PLANE 7: LOWERCASE UNSHIFTED [ "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" -UIEnter "m" "n" "o" UIBackspace -UILeft "p" "q" "r" "s" -UIRight "t" "u" "v" "w" +Duplicate "m" "n" "o" "" +StackEditor "p" "q" "r" "s" +Edit "t" "u" "v" "w" UILeftShift "x" "y" "z" "_" -UIExit ": :" "," " " Catalog +UIExit ": :" "," Run Catalog ] -// PLANE 7: LOWERCASE LEFT SHIFTED +// PLANE 8: LOWERCASE LEFT SHIFTED [ -"Σ" "^" "√" "∂" "ρ" "(" +"Σ" "^" "√" "∂" "ρ" "( )" "▶" "%" "π" "<" "=" ">" -UILowercase "⇄" "±" "∡" UIDelete -UILeft "7" "8" "9" "÷" -UIRight "4" "5" "6" "×" +UINoAlpha "⇄" "±" "∡" "" +EditorHistory "7" "8" "9" "÷" +EditMenu "4" "5" "6" "×" UIRightShift "1" "2" "3" "-" OffWithImage "0" UIDecimal "« »" "+" ] -// PLANE 8: LOWERCASE RIGHT SHIFTED +// PLANE 9: LOWERCASE RIGHT SHIFTED [ -"α" "β" "γ" "δ" "ε" "φ" -"Γ" "θ" "Δ" "λ" "λ" "ν" -UINoAlpha "Π" "Σ" "ω" UINewLine -UIUp "?" "∫" "[" "/" -UIDown "#" "∞" "|" "*" -UINoShift "&" "@" "$" "…" -OffWithImage ";" "·" "{ }" "!" +"∏" "∆" "↑" "μ" "θ" "' '" +"→" "←" "↓" "≤" "≠" "≥" +UIText "~" "°" "ε" "" +EditorHistory "?" "∫" "[" "/" +EditMenu "#" "∞" "|" "*" +UINoShift "&" "@" "$" "…" +SaveState ";" "·" "{ }" "!" ] From f46daf63e7673b32364f826a8c4c702c44b6d11a Mon Sep 17 00:00:00 2001 From: mipa83 Date: Fri, 27 Feb 2026 19:14:06 +0100 Subject: [PATCH 30/31] Updated keymaping to correspond to layout (image) Updated key mappings across various planes Signed-off-by: mipa83 --- config/db48x.48k | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/db48x.48k b/config/db48x.48k index e7ac6e015..6db25c33b 100644 --- a/config/db48x.48k +++ b/config/db48x.48k @@ -1,5 +1,5 @@ // Note: THIS plans show the commands that are executed when NOT in the editing mode. -// Following keys have diffente functino in editing mode: +// Following keys have different functions in editing mode: // KEY_BSP, KEY_ENTER, KEY_EXIT, KEY_UP, KEY_DOWN, KEY_CHS, KEY_E (EEX),KEY_RUN // PLANE 1: UNSHIFTED From fce1732a0c80c429ba4450ea0e36f23c95979133 Mon Sep 17 00:00:00 2001 From: mipa83 Date: Fri, 27 Feb 2026 19:19:31 +0100 Subject: [PATCH 31/31] remove accidentally added image Signed-off-by: mipa83 --- BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index 9ae9d77ad..32f61e174 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,4 +1,4 @@ -grafik# Building the DB48X project +# Building the DB48X project The DB48X project can be built in two variants: