Skip to content

Commit

Permalink
Improve keyboard layouts detection
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Nov 19, 2024
1 parent e730f2a commit e72a852
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion far/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,12 @@ static auto get_keyboard_layout_list_registry_ctf()
{
const auto Index = from_string<size_t>(IndexStr);
const auto Layout = LayoutsKey->get_dword(IndexStr, L"KeyboardLayout"sv);
Layouts.emplace_back(Index, *Layout);

// Seems to be IME
if (!*Layout && !extract_integer<uint16_t, 1>(Language.Id))
Layouts.emplace_back(Index, make_integer<uint32_t, uint16_t>(Language.Id, Language.Id));
else
Layouts.emplace_back(Index, *Layout);
}
catch (far_exception const& e)
{
Expand All @@ -694,6 +699,8 @@ static auto get_keyboard_layout_list_registry_ctf()
}

std::ranges::sort(Layouts, {}, &layout_item::Index);
const auto [First, Last] = std::ranges::unique(Layouts, {}, &layout_item::Id);
Layouts.erase(First, Last);
std::ranges::transform(Layouts, std::back_inserter(Result), [](layout_item const& i){ return os::make_hkl(i.Id); });
}

Expand Down

0 comments on commit e72a852

Please sign in to comment.