Skip to content

Commit

Permalink
Merge branch 'google:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
shitamo authored Jan 26, 2025
2 parents 53b7b0c + a0352ea commit 7886efc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ jobs:
- name: bazel test
working-directory: ./src
run: |
bazelisk test ... --config oss_linux --build_tests_only -c dbg
bazelisk test ... --config oss_linux -c dbg
1 change: 1 addition & 0 deletions src/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def mozc_win32_cc_prod_binary(
name = name + "_pdb_file",
srcs = [name],
output_group = "pdb_file",
target_compatible_with = target_compatible_with,
visibility = ["//visibility:private"],
)

Expand Down
39 changes: 21 additions & 18 deletions src/rewriter/date_rewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1520,9 +1520,12 @@ bool DateRewriter::Rewrite(const ConversionRequest &request,
return false;
}

bool modified = false;

const Segments::range conversion_segments = segments->conversion_segments();
if (conversion_segments.empty()) {
return false;
}

bool modified = false;
const std::string extra_format = GetExtraFormat(dictionary_);
size_t num_done = 1;
for (Segments::range rest_segments = conversion_segments;
Expand All @@ -1543,23 +1546,23 @@ bool DateRewriter::Rewrite(const ConversionRequest &request,
num_done = 1;
}

if (!conversion_segments.empty()) {
// Select the insert position by Romaji table. Note:
// TOGGLE_FLICK_TO_HIRAGANA uses digits for Hiragana composing, date/time
// conversion is performed even when typing Hiragana characters. Thus, it
// should not be promoted.
int insert_pos =
static_cast<int>(conversion_segments.front().candidates_size());
switch (request.request().special_romanji_table()) {
case commands::Request::QWERTY_MOBILE_TO_HALFWIDTHASCII:
insert_pos = 1;
break;
default:
break;
}
modified |=
RewriteConsecutiveDigits(request.composer(), insert_pos, segments);
// Select the insert position by Romaji table. Note:
// TOGGLE_FLICK_TO_HIRAGANA uses digits for Hiragana composing, date/time
// conversion is performed even when typing Hiragana characters. Thus, it
// should not be promoted.
int insert_pos =
static_cast<int>(conversion_segments.front().candidates_size());
switch (request.request().special_romanji_table()) {
case commands::Request::QWERTY_MOBILE_TO_HALFWIDTHASCII:
case commands::Request::FLICK_TO_NUMBER:
case commands::Request::TOGGLE_FLICK_TO_NUMBER:
insert_pos = 1;
break;
default:
break;
}
modified |=
RewriteConsecutiveDigits(request.composer(), insert_pos, segments);

return modified;
}
Expand Down

0 comments on commit 7886efc

Please sign in to comment.