OSDN Git Service

[Refactor] #3283 自動拾いの定義文作成をstringstream を使って簡潔にまとめた
authorHourier <66951241+Hourier@users.noreply.github.com>
Sun, 7 May 2023 09:23:20 +0000 (18:23 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 7 May 2023 10:47:10 +0000 (19:47 +0900)
src/autopick/autopick-entry.cpp

index e04561a..9894c30 100644 (file)
@@ -725,16 +725,7 @@ concptr autopick_line_from_entry(const autopick_type &entry)
             ss << ":";
         }
 
-        const auto i = ss.tellp();
-        auto j = 0;
-        while (entry.name[j] && (i < MAX_LINELEN - 2 - 1)) {
-#ifdef JP
-            if (iskanji(entry.name[j])) {
-                ss << entry.name[j++];
-            }
-#endif
-            ss << entry.name[j++];
-        }
+        ss << entry.name;
     }
 
     if (entry.insc.empty()) {
@@ -742,18 +733,7 @@ concptr autopick_line_from_entry(const autopick_type &entry)
         return string_make(str.data());
     }
 
-    ss << '#';
-    const auto i = ss.tellp();
-    auto j = 0;
-    while (entry.insc[j] && (i < MAX_LINELEN - 2)) {
-#ifdef JP
-        if (iskanji(entry.insc[j])) {
-            ss << entry.insc[j++];
-        }
-#endif
-        ss << entry.insc[j++];
-    }
-
+    ss << '#' << entry.insc;
     auto str = ss.str();
     return string_make(str.data());
 }