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

问题:添加“雾淞拼音”前后对比——自定义数字九宫格不再输出计算数值(如图示) #549

Closed
SunDD4 opened this issue Nov 16, 2023 · 4 comments

Comments

@SunDD4
Copy link

SunDD4 commented Nov 16, 2023

仓输入法,之前添加单一形码后,自定义九宫格计算器可输出计算数值(如图)
添加“雾淞拼音”方案之后,自定义九宫格计算器不再输出结果,求解决办法,在此感谢作者提供宝贵建议!
image

@SunDD4 SunDD4 changed the title 问题:添加“雾松拼音”前后对比——自定义数字九宫格不再输出计算数值(如图示) 问题:添加“雾淞拼音”前后对比——自定义数字九宫格不再输出计算数值(如图示) Nov 16, 2023
@iDvel
Copy link
Owner

iDvel commented Nov 16, 2023

什么意思,是这样吗,你之前用了一个以 = 开头触发的有计算功能的 Lua?
雾凇没有这样的 Lua,你需要:

  1. 将你之前用的 Lua 拷贝进来
  2. 启用这个 Lua
  3. 设置 = 不直接上屏

@SunDD4
Copy link
Author

SunDD4 commented Nov 17, 2023

是的没错,进入数字键盘后,以### =开头会出发计算功能的lua。

完全如您所说的,
但目前已解决一半——感谢提供思路:
一、在原RIME文件里找到了calculator_translator.lua 并拷贝到仓输入法-RIME-Lua文件夹内
二、同时在RIME下的rime.lua文件里加上“ calculator_translator = require("calculator_translator")→启用这个Lua

成功一半指:切换到原形方案时,自定义数字键盘可以输出计算结果
而切换到雾淞拼音的双拼方案时→无计算结果(因为=号直接上屏了)

找了一圈不知道怎么设置雾淞拼拼音### =号不上屏,如何设置呢? 再次感谢。

@SunDD4
Copy link
Author

SunDD4 commented Nov 17, 2023

已解决:
具体办法见<calculator_translator.lua> 说明书

第一步:將本文件保存至 /lua/
第二步: /rime.lua 新增一行:
calculator_translator = require("calculator_translator")

第三步:在 /<指定想要实现计算功能的方案里-schema>.schema.yaml
新增:engine/translators/ 加上这条:lua_translator@calculator_translator
新增:recognizer/patterns/ 加上这条:expression: "^=.*$"

@SunDD4 SunDD4 closed this as completed Nov 17, 2023
@iDvel
Copy link
Owner

iDvel commented Nov 17, 2023

对的,在 rime.lua 里 require 只是引用模块,启用是在方案的 engine 下启用的。
可以参考 librime-lua 的文档,还有一种方式是直接引用+启用:
https://github.com/hchunhui/librime-lua/wiki/Scripting#%E5%BC%95%E7%94%A8%E6%A8%A1%E5%9D%97

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

No branches or pull requests

2 participants