Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望中文模式下,紧跟数字的逗号也自动转换成半角 #712

Open
SogaSuga opened this issue Sep 14, 2023 · 4 comments
Open

Comments

@SogaSuga
Copy link

目前紧跟数字的句号和冒号会自动变半角,我希望逗号也能这样
因为很多时候输入长数字,需要输入千位、万位分隔符
比如1,000,000或者10,0000,0000.00
还有些地区的分隔符和小数点是相反的,即小数点是逗号,分隔符是句点
如果数字后的逗号也能自动变半角就会方便很多,现在每次输入长数字还要切换英文模式,有点麻烦。
谢谢!

@groverlynn
Copy link
Contributor

already implemented in #672

@shewer
Copy link
Contributor

shewer commented Sep 16, 2023

先用 librime-lua 止渴

-- digital.lua # 存入 user_dir/lua
-- lua_processor@*digital # 插入 engine/processors/ascii_compose 後
 -- 
 local P={}
 function P.init(env)
 end
 function P.fini(env)
 end
 function P.func(key,env)
  local context = env.engine.context
  if context:is_composing() then return 2 end
  if key:ctrl() or key:alt() or key:super() then return 2 end

  if key.keycode < 0x7f then
    local ascii_str= string.char(key.keycode)
    local last_ch= context.commit_history:back()
    if last_ch and last_ch.text:match("%d$") and ascii_str:match("[.,]") then
      return 0
    end
  end
  return 2
end
 return P

@lotem
Copy link
Member

lotem commented Feb 6, 2024

是不是還有後續,有高手做成能在方案裏配置的?

@shewer
Copy link
Contributor

shewer commented Feb 6, 2024

放在那 ascii_composer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants