OSDN Git Service

[Refactor] #2138 Separated process_control_command() from request_command()
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 19 Feb 2022 09:23:48 +0000 (18:23 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 20 Feb 2022 14:51:52 +0000 (23:51 +0900)
src/io/input-key-requester.cpp
src/io/input-key-requester.h

index 9918ceb..3fd167c 100644 (file)
@@ -78,12 +78,7 @@ void InputKeyRequestor::request_command()
         }
 
         this->process_command_command(&cmd);
-        if (cmd == '^') {
-            if (get_com(_("CTRL: ", "Control: "), (char *)&cmd, false)) {
-                cmd = KTRL(cmd);
-            }
-        }
-
+        this->process_control_command(&cmd);
         auto act = keymap_act[mode][(byte)(cmd)];
         if (act && !inkey_next) {
             (void)strnfmt(this->request_command_buffer, sizeof(this->request_command_buffer), "%s", act);
@@ -409,3 +404,14 @@ void InputKeyRequestor::process_command_command(short *cmd)
         inkey_next = "";
     }
 }
+
+void InputKeyRequestor::process_control_command(short *cmd)
+{
+    if (*cmd != '^') {
+        return;
+    }
+
+    if (get_com(_("CTRL: ", "Control: "), (char *)cmd, false)) {
+        *cmd = KTRL(*cmd);
+    }
+}
index b83e04a..4452653 100644 (file)
@@ -32,4 +32,5 @@ private:
     bool process_repeat_num(short *cmd);
     char input_repeat_num();
     void process_command_command(short *cmd);
+    void process_control_command(short *cmd);
 };