librime icon indicating copy to clipboard operation
librime copied to clipboard

Added member xxx_notify() to class Context and catch exception to stop the propagation

Open shewer opened this issue 3 months ago • 5 comments

Pull request

Added member xxx_notify() to class Context and catch exception to stop the propagation

Issue tracker

Fixes will automatically close the related issue

Fixes #

Feature

Describe feature of pull request

Unit test

  • [ ] Done

Manual test

  • [ ] Done

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

1 class StopSlotException : public std::runtime_error 2 stop propagation when catch StopSlotException 3 added member in class Context . commit_notify() . update_notify() . select_notify() . abort_notify() . option_update_notify(const string&) . property_update_notify(const string&) . unhandled_key_notify(const KeyEvent&)

shewer avatar Aug 30 '25 02:08 shewer

可能有一定幫助吧。但是我也注意到 update_notifier() 等這一系列 getter 已經把 Notifier 對象暴露給其他組件了。 PR 裏的修改只能管住 Context 類的發的通知,管不住其他代碼發的通知。有沒有辦法?

lotem avatar Sep 24 '25 05:09 lotem

可能有一定幫助吧。但是我也注意到 update_notifier() 等這一系列 getter 已經把 Notifier 對象暴露給其他組件了。 PR 裏的修改只能管住 Context 類的發的通知,管不住其他代碼發的通知。有沒有辦法?

已在 Context 加入 connect method 了, 也改了librime 中中有使用 notify 的code , 但沒有移除 notifier 外露 ,因為librime-lua script 還有在使用 notifier

shewer avatar Oct 24 '25 12:10 shewer

我刚刚看明白这个不是防范异常的。

lotem avatar Oct 28 '25 02:10 lotem

究竟要做什么,请讲讲。

如果要实现某个功能,我想了解这个功能的完整设计。 只见到你设计好的一套实现,我无法判断这种实现能否有效应对现实中的问题、是否最优设计。

lotem avatar Oct 28 '25 02:10 lotem

原本只是要增加 Context notify 的接口,你提議想把 notifier 封裝起來,所以我再加上connect 接口.

shewer avatar Oct 28 '25 07:10 shewer