diff options
author | Bian Jiaping | 2018-09-16 15:00:36 +0800 |
---|---|---|
committer | Bian Jiaping | 2018-09-16 15:00:36 +0800 |
commit | d3c29b25b34ad3b0f8387b6d5cb92b1fd984d1a4 (patch) | |
tree | f94848a9844b9aef672a0cfa58c6f9861ce308ca | |
parent | f805e73bb8db88797f60cad99781b14a0b0ca734 (diff) | |
download | aur-d3c29b25b34ad3b0f8387b6d5cb92b1fd984d1a4.tar.gz |
Update to 3175
-rw-r--r-- | .SRCINFO | 49 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | LICENSE | 3 | ||||
-rw-r--r-- | PKGBUILD | 134 | ||||
-rw-r--r-- | README.md | 180 | ||||
-rwxr-xr-x | subl | 2 | ||||
-rw-r--r-- | sublime_imfix.c | 264 | ||||
-rwxr-xr-x | sublime_text_3.sh | 23 | ||||
-rw-r--r-- | sublime_text_3_imfix.install | 85 | ||||
-rwxr-xr-x | sublime_text_3_imfix.sh | 24 |
10 files changed, 347 insertions, 422 deletions
@@ -1,41 +1,32 @@ pkgbase = sublime-text-dev-imfix - pkgdesc = Sophisticated text editor for code, HTML and prose, development build with Fcitx input method support - pkgver = 3.3126 + pkgdesc = Sophisticated text editor for code, markup and prose - Dev build with input method support for CJK users + pkgver = 3.3175 pkgrel = 1 - url = http://www.sublimetext.com/3 - install = sublime_text_3_imfix.install - changelog = README.md + url = https://www.sublimetext.com/3dev arch = i686 arch = x86_64 license = custom - depends = desktop-file-utils - depends = gtk2 depends = libpng - optdepends = gksu: sudo-save support - provides = sublime-text-dev=3.3126 + depends = gtk2 + provides = sublime-text + provides = sublime-text-dev provides = sublime-text-nightly + conflicts = sublime-text conflicts = sublime-text-dev conflicts = sublime-text-nightly - options = !strip - source = SublimeText-i18n-zh-master.zip::https://github.com/farseerfc/SublimeText-i18n-zh/archive/master.zip - source = LICENSE - source = sublime_text_3.sh - source = sublime_text_3_imfix.sh - sha512sums = dcdbe5c4aeea56c66f284ca0bd7bc9ff1b31e3e5f63cdc5ae694b90252a6606564e7defa5ad317025b11faa59f962a4d9cc2b3d4355ebd02edbced715892d6f4 - sha512sums = 54b356867e6699fe88130c183ec76ea631f4afeab1a15f37e9ecd460f726bc7c80f056fd57637c24a67b865522e9d3bb5156414fe3cc5d091be9e1f21ef0f31f - sha512sums = 32023ae446a981cbf22c1e7c056d1bec76b1a8c4cba1a625d8314331c947ff3d12adaa24f267794f270de76a1170d19405a57100db1054760bfeeb29950bb5a0 - sha512sums = 3ed8d47663d6e825ff3321155a65e1afa691fea541b96500d11ac763c55741db5712a307f6695fdf5f6d09a71d195efea494736026612bac5d0e410bc1e43c1f - source_i686 = https://download.sublimetext.com/sublime_text_3_build_3126_x32.tar.bz2 - sha512sums_i686 = f8377adbad072577995918c7c8311ae63c7290581b00200e698ded18722893edf0baa7227480c8fc6143be30d695fae1e7312f7a9ac6728b8a397ea814a829fa - source_x86_64 = http://download.sublimetext.com/sublime_text_3_build_3126_x64.tar.bz2 - sha512sums_x86_64 = a0a683b3cef45fba2a294cb044e5dc24ed3ea8d8a669321ee15844a48b88fbd345d50f499a9feb865735b15b44ff99d6b5f8aaee453245b9fd61e9e3d1c69f26 + source = subl + source = sublime_imfix.c + validpgpkeys = 1EDDE2CDFC025D17F6DA9EC0ADAE6AD28A8F901A + sha256sums = 1ec8b8212e70cbe8612048ec039402cee044527507e72d8020c551ebbd5b2789 + sha256sums = 5903b47f7dfbf079987c566361c5735a002dcbf25d0f86de86b7dce424f36700 + source_i686 = https://download.sublimetext.com/sublime_text_3_build_3175_x32.tar.bz2.asc + source_i686 = https://download.sublimetext.com/sublime_text_3_build_3175_x32.tar.bz2 + sha256sums_i686 = SKIP + sha256sums_i686 = SKIP + source_x86_64 = https://download.sublimetext.com/sublime_text_3_build_3175_x64.tar.bz2.asc + source_x86_64 = https://download.sublimetext.com/sublime_text_3_build_3175_x64.tar.bz2 + sha256sums_x86_64 = SKIP + sha256sums_x86_64 = SKIP pkgname = sublime-text-dev-imfix - pkgdesc = Sophisticated text editor for code, HTML and prose, development build with Fcitx input method support - -pkgname = sublime-text-dev-zh-cn - pkgdesc = Sophisticated text editor for code, HTML and prose, development build with Simplified Chinese translation and Fcitx input method support - -pkgname = sublime-text-dev-zh-tw - pkgdesc = Sophisticated text editor for code, HTML and prose, development build with Traditional Chinese translation and Fcitx input method support diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..afc046290b16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/pkg +/src +/*.tar.bz2 +/*.asc +/*.pkg.* diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 3e2f842607c7..000000000000 --- a/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -Sublime Text may be downloaded and evaluated for free, however a license must be purchased for continued use. -Licenses are per-user, rather than per-machine, so you can enjoy Sublime Text on as many computers and operating systems as you wish with your license. -For more information, please visit https://www.sublimetext.com/buy @@ -1,116 +1,62 @@ -# Maintainer : farseerfc <farseerfc@archlinuxcn.org> +# Maintainer: Bian Jiaping <ssbianjp@gmail.com> +# Contributor : farseerfc <farseerfc@archlinuxcn.org> # Contributor : Fernando "Firef0x" G.P. da Silva <firefgx { aT ) gmail [ d0t } com> # Contributor : Sander Boom <sander at inflowmotion dot nl> (From sublime-text-dev) # Contributor : realitygaps <realitygaps at yahoo dot com> (From sublime-text-dev) # Contributor : ska <skatiger (at} gmail {dot) com> (From sublime-text-imfix) -pkgname=('sublime-text-dev-imfix' 'sublime-text-dev-zh-cn' 'sublime-text-dev-zh-tw') -pkgver=3.3126 +pkgname=sublime-text-dev-imfix +pkgver=3.3175 pkgrel=1 +pkgdesc="Sophisticated text editor for code, markup and prose - Dev build with input method support for CJK users" arch=('i686' 'x86_64') -url="http://www.sublimetext.com/3" +url="https://www.sublimetext.com/3dev" license=('custom') -depends=('desktop-file-utils' 'gtk2' 'libpng') -optdepends=('gksu: sudo-save support') -provides=("sublime-text-dev=${pkgver}" 'sublime-text-nightly') -conflicts=('sublime-text-dev' 'sublime-text-nightly') -options=('!strip') -changelog=README.md -pkgdesc="Sophisticated text editor for code, HTML and prose, development build with Fcitx input method support" +depends=('libpng' 'gtk2') +conflicts=('sublime-text' 'sublime-text-dev' 'sublime-text-nightly') +provides=('sublime-text' 'sublime-text-dev' 'sublime-text-nightly') -_pkgname=sublime_text_3 -_pkgname1="${_pkgname}_imfix" -_branchname="SublimeText-i18n-zh-master" +validpgpkeys=("1EDDE2CDFC025D17F6DA9EC0ADAE6AD28A8F901A") -install=${_pkgname1}.install +source=('subl' 'sublime_imfix.c') +source_i686=( + "https://download.sublimetext.com/sublime_text_3_build_${pkgver:2}_x32.tar.bz2.asc" + "https://download.sublimetext.com/sublime_text_3_build_${pkgver:2}_x32.tar.bz2" +) +source_x86_64=( + "https://download.sublimetext.com/sublime_text_3_build_${pkgver:2}_x64.tar.bz2.asc" + "https://download.sublimetext.com/sublime_text_3_build_${pkgver:2}_x64.tar.bz2" +) -source=("${_branchname}.zip::https://github.com/farseerfc/SublimeText-i18n-zh/archive/master.zip" - "LICENSE" - "${_pkgname}.sh" - "${_pkgname1}.sh") -source_i686=("https://download.sublimetext.com/${_pkgname}_build_${pkgver:2}_x32.tar.bz2") -source_x86_64=("http://download.sublimetext.com/${_pkgname}_build_${pkgver:2}_x64.tar.bz2") +sha256sums=('1ec8b8212e70cbe8612048ec039402cee044527507e72d8020c551ebbd5b2789' + '5903b47f7dfbf079987c566361c5735a002dcbf25d0f86de86b7dce424f36700' + ) -sha512sums=('dcdbe5c4aeea56c66f284ca0bd7bc9ff1b31e3e5f63cdc5ae694b90252a6606564e7defa5ad317025b11faa59f962a4d9cc2b3d4355ebd02edbced715892d6f4' - '54b356867e6699fe88130c183ec76ea631f4afeab1a15f37e9ecd460f726bc7c80f056fd57637c24a67b865522e9d3bb5156414fe3cc5d091be9e1f21ef0f31f' - '32023ae446a981cbf22c1e7c056d1bec76b1a8c4cba1a625d8314331c947ff3d12adaa24f267794f270de76a1170d19405a57100db1054760bfeeb29950bb5a0' - '3ed8d47663d6e825ff3321155a65e1afa691fea541b96500d11ac763c55741db5712a307f6695fdf5f6d09a71d195efea494736026612bac5d0e410bc1e43c1f') -sha512sums_i686=('f8377adbad072577995918c7c8311ae63c7290581b00200e698ded18722893edf0baa7227480c8fc6143be30d695fae1e7312f7a9ac6728b8a397ea814a829fa') -sha512sums_x86_64=('a0a683b3cef45fba2a294cb044e5dc24ed3ea8d8a669321ee15844a48b88fbd345d50f499a9feb865735b15b44ff99d6b5f8aaee453245b9fd61e9e3d1c69f26') +sha256sums_x86_64=('SKIP' 'SKIP') +sha256sums_i686=('SKIP' 'SKIP') build() { - cp "${srcdir}/${_branchname}/dist/any/desktop/"* . - cp "${srcdir}/${_branchname}/dist/any/zh_CN/"* . - cp "${srcdir}/${_branchname}/dist/any/zh_TW/"* . - cp "${srcdir}/${_branchname}/src/fix/imfix/sublime_imfix.c" . - gcc -shared -o libsublime-imfix.so `pkg-config --libs --cflags gtk+-2.0` -fPIC sublime_imfix.c + # build imfix library + gcc -shared -o libsublime-imfix.so $(pkg-config --libs --cflags gtk+-2.0) -fPIC sublime_imfix.c } -_package_common() { - # Copy everything - install -d "${pkgdir}/opt" - cp --preserve=mode -r "${_pkgname}" "${pkgdir}/opt/${_pkgname}" +package() { + cd "${srcdir}" - # Install IM fix library - install -Dm755 libsublime-imfix.so \ - ${pkgdir}/opt/${_pkgname}/libsublime-imfix.so + install -dm755 "${pkgdir}/opt" + cp --preserve=mode -r "sublime_text_3" "${pkgdir}/opt/sublime_text" + + # Install imfix library + install -Dm755 libsublime-imfix.so "${pkgdir}/opt/sublime_text/libsublime-imfix.so" - # Install icons and desktop shortcuts for res in 16x16 32x32 48x48 128x128 256x256; do - install -d "${pkgdir}/usr/share/icons/hicolor/${res}/apps" - ln -sf "/opt/${_pkgname}/Icon/${res}/sublime-text.png" \ - "${pkgdir}/usr/share/icons/hicolor/${res}/apps/sublime-text.png" + install -dm755 "${pkgdir}/usr/share/icons/hicolor/${res}/apps" + ln -s "/opt/sublime_text/Icon/${res}/sublime-text.png" "${pkgdir}/usr/share/icons/hicolor/${res}/apps/sublime-text.png" done - install -d "${pkgdir}/usr/share/applications" - install -Dm644 ${_pkgname}.desktop \ - "${pkgdir}/usr/share/applications/${_pkgname}.desktop" - install -Dm644 ${_pkgname1}.desktop \ - "${pkgdir}/usr/share/applications/${_pkgname1}.desktop" - - # Install bin file - install -d "${pkgdir}/usr/bin" - install -Dm755 ${_pkgname}.sh "${pkgdir}/usr/bin/${_pkgname}" - install -Dm755 ${_pkgname1}.sh "${pkgdir}/usr/bin/${_pkgname1}" - - # Make symbolic links - ln -sf "/usr/bin/${_pkgname1}" "${pkgdir}/usr/bin/subl3" - - # Install license file - install -d "${pkgdir}/usr/share/licenses/${pkgname}" - install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" -} - -package_sublime-text-dev-imfix() { - pkgdesc="Sophisticated text editor for code, HTML and prose, development build with Fcitx input method support" - - _package_common -} - -package_sublime-text-dev-zh-cn() { - pkgdesc="Sophisticated text editor for code, HTML and prose, development build with Simplified Chinese translation and Fcitx input method support" - - rm "${_pkgname}/Packages/Default.sublime-package" - install -Dm644 Default.zh_CN.sublime-package \ - ${_pkgname}/Packages/Default.sublime-package - - _package_common - - # Install license file - install -Dm644 LICENSE.zh_CN "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.zh_CN" + install -dm755 "${pkgdir}/usr/share/applications" + install -Dm644 "sublime_text_3/sublime_text.desktop" "${pkgdir}/usr/share/applications/sublime_text.desktop" + sed -i 's#/opt/sublime_text/sublime_text#subl#g' "${pkgdir}/usr/share/applications/sublime_text.desktop" + install -Dm755 subl "${pkgdir}/usr/bin/subl" + ln -s /opt/sublime_text/sublime_text "${pkgdir}/usr/bin/subl-noimfix" } - -package_sublime-text-dev-zh-tw() { - pkgdesc="Sophisticated text editor for code, HTML and prose, development build with Traditional Chinese translation and Fcitx input method support" - - rm "${_pkgname}/Packages/Default.sublime-package" - install -Dm644 Default.zh_TW.sublime-package \ - ${_pkgname}/Packages/Default.sublime-package - - _package_common - - # Install license file - install -Dm644 LICENSE.zh_TW "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.zh_TW" -} - -# vim:set sts=2 sw=2 ts=2 et: diff --git a/README.md b/README.md index 168f2cc7d843..873765e30f68 100644 --- a/README.md +++ b/README.md @@ -1,173 +1,25 @@ -# CHANGELOG 更新日志 更新日誌 +# Sublime Text 3 Imfix -#### 3.3065-3 ----------- -##### 2015-02-12 Fernando "Firef0x" G.P. da Silva <firefgx { aT ) gmail [ d0t } com> +Sublime Text 3 dev build with input method support for CJK users. -* Add package `sublime-text-dev-zh-tw` providing Traditional Chinese translation -* 添加软件包 `sublime-text-dev-zh-tw` 以提供繁体中文翻译 -* 新增軟體套件 `sublime-text-dev-zh-tw` 以提供繁體中文翻譯 -* Refine desktop entries -* 完善桌面图标 -* 完善桌面圖示 +The solution is provided by cjacker and whitequark on [sublime text forum][imfix-solution]. --------------------------------------------------------------------------------- +## Installation -#### 3.3065-2 ----------- -##### 2014-12-15 Fernando "Firef0x" G.P. da Silva <firefgx { aT ) gmail [ d0t } com> +Before the first time you install it, you need to import and trust Sublime's GPG key: -* Add package `sublime-text-dev-zh-cn` providing Simplified Chinese translation -* 添加软件包 `sublime-text-dev-zh-cn` 以提供简体中文翻译 -* 新增軟體套件 `sublime-text-dev-zh-cn` 以提供簡體中文翻譯 +```bash +gpg --recv-keys 1EDDE2CDFC025D17F6DA9EC0ADAE6AD28A8F901A +``` --------------------------------------------------------------------------------- +```bash +yay -S sublime-text-dev-imfix +``` -From `Build 3065`, the launch script [subl3][1] is split into two launch scripts -[sublime_text_3][2] and [sublime_text_3_imfix][3]. -[sublime_text_3][2] would launch the original executable `sublime_text` -without loading the library [libsublime-imfix.so][4]. -`/usr/bin/subl3` is a symlink to `/usr/bin/sublime_text_3_imfix` as default, -and you could re-link it to `/usr/bin/sublime_text_3` if you like. (Or re-link -it to `/usr/bin/vim` or `/usr/bin/emacs` if you like O(^_^)O) +## Known issues -The desktop entry [sublime_text_3.desktop][5] is also split into two desktop -entries [sublime_text_3.desktop][6] and [sublime_text_3_imfix.desktop][7]. Note -that [sublime_text_3_imfix.desktop][7] is corresponding to -[sublime_text_3.desktop][5] in previous version. +* `Open in Browser` of html files not work +* `Preview in Browser` of [MarkdownPreview plugin][markdown-preview] not work --------------------------------------------------------------------------------- - -从`构建版本 3065` 开始,运行脚本 [subl3][1] 分为两个运行脚本 [sublime_text_3][2] -和 [sublime_text_3_imfix][3]。[sublime_text_3][2] 将不加载链接库 -[libsublime-imfix.so][4] 直接运行原来的可执行文件 `sublime_text`。 -`/usr/bin/subl3` 默认为一个指向 `/usr/bin/sublime_text_3_imfix` 的符号链接。 -只要您愿意,您可以重新链接到 `/usr/bin/sublime_text_3`。(或者重新链接到 -`/usr/bin/vim` 或者 `/usr/bin/emacs`,如果您愿意的话。O(^_^)O) - -桌面图标 [sublime_text_3.desktop][5] 同样分为两个桌面图标 [sublime_text_3.desktop][6] -和 [sublime_text_3_imfix.desktop][7]。请注意,[sublime_text_3_imfix.desktop][7] -对应于之前版本的 [sublime_text_3.desktop][5]。 - --------------------------------------------------------------------------------- - -從`構建版本 3065` 開始,啟動指令碼 [subl3][1] 分為兩個啟動指令碼 -[sublime_text_3][2] 和 [sublime_text_3_imfix][3]。[sublime_text_3][2] 將不載入連 -結庫 [libsublime-imfix.so][4] 直接運行原來的可執行檔案 `sublime_text`。 -`/usr/bin/subl3` 預設為一個指向 `/usr/bin/sublime_text_3_imfix` 的符號連結。 -只要您願意,您可以重新連結到 `/usr/bin/sublime_text_3`。(或者重新連結到 -`/usr/bin/vim` 或者 `/usr/bin/emacs`,如果您願意的話。O(^_^)O) - -桌面圖示 [sublime_text_3.desktop][5] 同樣分為兩個桌面圖示 [sublime_text_3.desktop][6] -和 [sublime_text_3_imfix.desktop][7]。請注意,[sublime_text_3_imfix.desktop][7] -對應於之前版本的 [sublime_text_3.desktop][5]。 - --------------------------------------------------------------------------------- - -## The following is the changelog for the latest build: -## 以下是最新版本的更新日志: -## 以下是最新版本的更新日誌: - -Sublime Text 3 is currently in beta. The latest build is 3083. - -#### Build 3083 ----------- -Release Date: 26 March 2015 - -* Fixed high CPU usage caused by a corrupt index. This was occuring for some users upgrading from 3065 -* Added setting index_workers to control the number of threads used for file indexing. By default the number of threads is based on the number of CPU cores. By setting index_workers to 1 or 2, indexing will be slower, but less intrusive -* Fixed a crash when showing the Command Palette with an empty .sublime-build file -* Tab completion no longer completes numbers. Edit/Show Completions can still be used for this - -#### Build 3080 ----------- -Release Date: 24 March 2015 -See also the [Blog Post][8]. - -* Fixed Redo sometimes restoring the selection to the incorrect location -* Reworked how Build Systems are selected (More Information) -* Build Systems may now declare "keyfiles" (e.g., 'Makefile' for the Make build system) to better auto detect which build system to use -* Improved handling of build systems that generate lots of output -* New windows always use the automatic build system, rather than the build system of the last used window -* Command Palette now remembers the last entered string -* Improved change detection for files that disappear and reappear, as happens with disconnected network drives -* atomic_save is disabled by default -* Right clicking on a URL will show an "Open URL" menu item -* Added Goto Definition to the context menu -* Improved behavior of Goto Definition when using multiple panes -* Misspelled words can now be added to the dictionary, in addition to being ignored -* Fixed Ignored Words not persisting after exiting -* Fixed a long standing issue with spell checking and non-ascii characters -* Added spelling_selector setting, to control what text is checked for misspellings -* Tweaked handling of syntax definitions and unused captures, resolving an issue with spell checking in Markdown links. -* Goto Anything supports :line:col syntax in addition to :line -* Added Edit Project to the Command palette -* Improved quote auto pairing logic -* Added <current file> option to Find in Files -* Improved Console Panel scrolling behavior -* .tmLanguage files may contain a hidden setting, to indicate they shouldn't be displayed to the user -* Improved some error messages when parsing .tmLanguage files -* remember_open_files setting is now defaults to false. Note that this change will have no effect if the hot_exit setting is left at its default value of true -* Added auto_complete_cycle setting -* Fixed Minimap refusing to draw on very large windows -* Fixed not being able to click on the selected row of the auto complete popup -* Fixed sidebar icons sometimes being invisible on startup -* Transient sheets (e.g., as created by Goto Anything when previewing files) are no longer added to the Recently Closed list -* Improved scrolling behavior when line_padding_top is > 0 -* Fixed a bug with scrolling tabs, where a 1 pixel line would occasionally appear underneath them -* Fixed tabset background being set to the wrong color on startup if different colored tabs are used -* Updated to a never version of leveldb, fixing constant low level CPU usage if the index becomes corrupted -* Fixed a crash that could occur when directories are being rapidly deleted and recreated -* Fixed a crash that occurred when dragging rows scrolled out of view in the side bar -* Fixed a long standing plugin_host crash triggered via modal dialogs -* Fixed a typo in the "Save Workspace As" dialog -* Fixed incorrect menu mnemonics -* Linux: Added sudo save -* Windows: Popup windows are able to receive scroll wheel input -* Windows: subl.exe command line helper accepts wildcards -* Windows: Fixed access denied errors that could occur when saving with atomic_save disabled -* Windows: Added workaround for broken std::condition_variable in MSVC 2012, fixing a crash in plugin_host -* Windows: Added more descriptive errors when the Update Installer fails to rename a folder -* Windows: Fixed incorrect window sizing after making a maximised window full screen -* OSX: Added work around for performActionForItemAtIndex: taking an excessively long time in Yosemite. This affected any commands that had a corresponding menu item. -* OSX: Workaround for an OS issue with zero size windows and OpenGL views -* OSX: subl command line tool no longer uses Distributed Objects, resolving some intermittent failures -* Posix: Fixed new files not respecting the umask permission flags -* API: Added View.show_popup() and related functions -* API: Added sublime.yes_no_cancel_dialog() -* API: Added sublime.expand_variables() -* API: Added Window.extract_variables() -* API: Added Sheet.view() -* API: Window.show_quick_panel() now accepts the flag sublime.KEEP_OPEN_ON_FOCUS_LOST -* API: Window.show_quick_panel() will now scroll to the selected item when shown -* API: Fixed on_post_window_command() not getting called - -#### Build 3065 ----------- -Release Date: 29 August 2014 - -* Added sidebar icons -* Added sidebar loading indicators -* Sidebar remembers which folders are expanded -* Tweaked window closing behavior when pressing ctrl+w / cmd+w -* Improved quote auto pairing logic -* Selected group is now stored in the session -* Added remember_full_screen setting -* Fixed a lockup when transitioning from a blinking to a solid caret -* Fixed a crash in plugin_host -* Fixed a crash triggered by Goto Anything cloning views -* Windows: Added command line helper, subl.exe -* OSX: Added 'New Window' entry to dock menu -* Posix: Using correct permissions for newly created files and folders -* API: Updated to Python 3.3.3 - -For more changelog and information, please visit http://www.sublimetext.com/3 - -[1]: https://github.com/Firef0x/AUR-Firef0x/blob/75afa8662d4185afd15cdbbab0c8418a39e85b20/aur/sublime-text-dev-imfix/subl3 -[2]: https://github.com/Firef0x/AUR-Firef0x/blob/master/aur/sublime-text-dev-imfix/sublime_text_3.sh -[3]: https://github.com/Firef0x/AUR-Firef0x/blob/master/aur/sublime-text-dev-imfix/sublime_text_3_imfix.sh -[4]: https://github.com/Firef0x/SublimeText-i18n-zh/blob/master/dist/x86_64/libsublime-imfix.x86_64.so -[5]: https://github.com/Firef0x/AUR-Firef0x/blob/377934551a2476668ddc41e4e074f14c2e98294d/aur/sublime-text-dev-imfix/sublime_text_3.desktop -[6]: https://github.com/Firef0x/SublimeText-i18n-zh/blob/master/dist/any/desktop/sublime_text_3.desktop -[7]: https://github.com/Firef0x/SublimeText-i18n-zh/blob/master/dist/any/desktop/sublime_text_3_imfix.desktop -[8]: http://www.sublimetext.com/blog/articles/sublime-text-3-build-3080 +[imfix-solution]: https://forum.sublimetext.com/t/input-method-support/5446/27 +[markdown-preview]: https://packagecontrol.io/packages/MarkdownPreview @@ -0,0 +1,2 @@ +#!/usr/bin/bash +LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so /opt/sublime_text/sublime_text "$@" diff --git a/sublime_imfix.c b/sublime_imfix.c new file mode 100644 index 000000000000..cd293ffe23ef --- /dev/null +++ b/sublime_imfix.c @@ -0,0 +1,264 @@ +/* +sublime-imfix.c +Use LD_PRELOAD to interpose some function to fix sublime input method support for linux. +By Cjacker Huang <jianzhong.huang at i-soft.com.cn> +By whitequark@whitequark.org + +How to compile: +gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC +How to use: +LD_PRELOAD=./libsublime-imfix.so sublime_text + +Changes: +2014 06-09 +1, Fix cursor position update for sublime text 3. +2, Combine the codes from whitequark(fix for xim immodule) and add cursor update support for XIM immodule. +*/ + +/*for RTLD_NEXT*/ +#define _GNU_SOURCE + +#include <gtk/gtk.h> +#include <gdk/gdkx.h> +#include <assert.h> +#include <dlfcn.h> +#include <stdio.h> +#include <string.h> +#include <gtk/gtk.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +#ifdef VERBOSE +#define DEBUG(fmt, ...) do { \ + FILE* err = fopen("/tmp/libsublime-immethod-fix.log", "a"); \ + if (err) { \ + fprintf(err, fmt, __VA_ARGS__); \ + fclose(err); \ + } \ + } while(0) +#else +#define DEBUG(fmt, ...) +#endif + + +typedef GdkSegment GdkRegionBox; + +struct _GdkRegion +{ + long size; + long numRects; + GdkRegionBox *rects; + GdkRegionBox extents; +}; + +GtkIMContext *local_context; + + +//this func is interposed to support cursor position update. +void +gdk_region_get_clipbox (const GdkRegion *region, + GdkRectangle *rectangle) +{ + g_return_if_fail (region != NULL); + g_return_if_fail (rectangle != NULL); + + rectangle->x = region->extents.x1; + rectangle->y = region->extents.y1; + rectangle->width = region->extents.x2 - region->extents.x1; + rectangle->height = region->extents.y2 - region->extents.y1; + GdkRectangle rect; + rect.x = rectangle->x; + rect.y = rectangle->y; + rect.width = 0; + rect.height = rectangle->height; + //The caret width is 2 in sublime text 2 + //And is 1 in sublime text 3. + //Maybe sometimes we will make a mistake, but for most of the time, it should be the caret. + if((rectangle->width == 2 || rectangle->width == 1) && GTK_IS_IM_CONTEXT(local_context)) { + gtk_im_context_set_cursor_location(local_context, rectangle); + } +} + +//this is needed, for example, if you input something in file dialog and return back the edit area +//context will lost, so here we set it again. +static GdkFilterReturn event_filter (GdkXEvent *xevent, GdkEvent *event, gpointer im_context) +{ + XEvent *xev = (XEvent *)xevent; + if(xev->type == KeyRelease && GTK_IS_IM_CONTEXT(im_context)) { + GdkWindow * win = g_object_get_data(G_OBJECT(im_context),"window"); + if(GDK_IS_WINDOW(win)) + gtk_im_context_set_client_window(im_context, win); + } + return GDK_FILTER_CONTINUE; +} + +void gtk_im_context_set_client_window (GtkIMContext *context, + GdkWindow *window) +{ + GtkIMContextClass *klass; + g_return_if_fail (GTK_IS_IM_CONTEXT (context)); + klass = GTK_IM_CONTEXT_GET_CLASS (context); + if (klass->set_client_window) + klass->set_client_window (context, window); + + //below is our interposed codes to save the context to local_context. + if(!GDK_IS_WINDOW (window)) + return; + g_object_set_data(G_OBJECT(context),"window",window); + int width = gdk_window_get_width(window); + int height = gdk_window_get_height(window); + if(width != 0 && height !=0) { + gtk_im_context_focus_in(context); + local_context = context; + } + //only add this event_filter when using 'fcitx' immodule. + //for xim immodule, this function is as same as original from gtk2. + const gchar * immodule = g_getenv("GTK_IM_MODULE"); + if(immodule && !strcmp(immodule, "fcitx")) { + gdk_window_add_filter (window, event_filter, context); + } +} + + +/*below codes is from whitequark, fix for xim immodule*/ + +/* See gtkimcontextxim.c */ +GType gtk_type_im_context_xim = 0; + +#define GTK_TYPE_IM_CONTEXT_XIM (gtk_type_im_context_xim) +#define GTK_IM_CONTEXT_XIM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIM)) +#define GTK_IM_CONTEXT_XIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIMClass)) +#define GTK_IS_IM_CONTEXT_XIM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IM_CONTEXT_XIM)) +#define GTK_IS_IM_CONTEXT_XIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT_XIM)) +#define GTK_IM_CONTEXT_XIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT_XIM, GtkIMContextXIMClass)) + +typedef struct _GtkIMContextXIM GtkIMContextXIM; +typedef struct _GtkIMContextXIMClass GtkIMContextXIMClass; + +struct _GtkIMContextXIMClass +{ + GtkIMContextClass parent_class; +}; + +typedef struct _StatusWindow StatusWindow; +typedef struct _GtkXIMInfo GtkXIMInfo; + +struct _GtkIMContextXIM +{ + GtkIMContext object; + + GtkXIMInfo *im_info; + + gchar *locale; + gchar *mb_charset; + + GdkWindow *client_window; + GtkWidget *client_widget; + + /* The status window for this input context; we claim the +* * status window when we are focused and have created an XIC +* */ + StatusWindow *status_window; + + gint preedit_size; + gint preedit_length; + gunichar *preedit_chars; + XIMFeedback *feedbacks; + + gint preedit_cursor; + + XIMCallback preedit_start_callback; + XIMCallback preedit_done_callback; + XIMCallback preedit_draw_callback; + XIMCallback preedit_caret_callback; + + XIMCallback status_start_callback; + XIMCallback status_done_callback; + XIMCallback status_draw_callback; + + XIMCallback string_conversion_callback; + + XIC ic; + + guint filter_key_release : 1; + guint use_preedit : 1; + guint finalizing : 1; + guint in_toplevel : 1; + guint has_focus : 1; +}; + +static GClassInitFunc orig_gtk_im_context_xim_class_init; +static GType (*orig_g_type_module_register_type)(GTypeModule *, + GType, const gchar *, + const GTypeInfo *, GTypeFlags); +static gboolean (*orig_gtk_im_context_xim_filter_keypress)(GtkIMContext *context, + GdkEventKey *event); + +static gboolean +hook_gtk_im_context_xim_filter_keypress(GtkIMContext *context, GdkEventKey *event) { + GtkIMContextXIM *im_context_xim = GTK_IM_CONTEXT_XIM(context); + if (!im_context_xim->client_window) { + DEBUG("im_context_xim == %p\n", im_context_xim); + DEBUG("event->window == %p\n", event->window); + + gtk_im_context_set_client_window(context, event->window); + } + + return orig_gtk_im_context_xim_filter_keypress(context, event); +} + +static void +hook_gtk_im_context_xim_class_init (GtkIMContextXIMClass *class) { + orig_gtk_im_context_xim_class_init(class, NULL); /* wat? */ + + GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class); + + assert(!orig_gtk_im_context_xim_filter_keypress); + orig_gtk_im_context_xim_filter_keypress = im_context_class->filter_keypress; + im_context_class->filter_keypress = hook_gtk_im_context_xim_filter_keypress; + DEBUG("orig_gtk_im_context_xim_filter_keypress: %p\n", + orig_gtk_im_context_xim_filter_keypress); +} + +GType +g_type_module_register_type (GTypeModule *module, + GType parent_type, + const gchar *type_name, + const GTypeInfo *type_info, + GTypeFlags flags) { + if (!orig_g_type_module_register_type) { + orig_g_type_module_register_type = dlsym(RTLD_NEXT, "g_type_module_register_type"); + assert(orig_g_type_module_register_type); + } + + if (type_name && !strcmp(type_name, "GtkIMContextXIM")) { + assert(!orig_gtk_im_context_xim_class_init); + orig_gtk_im_context_xim_class_init = type_info->class_init; + + assert(sizeof(GtkIMContextXIM) == type_info->instance_size); + + const GTypeInfo hook_im_context_xim_info = + { + type_info->class_size, + type_info->base_init, + type_info->base_finalize, + (GClassInitFunc) hook_gtk_im_context_xim_class_init, + type_info->class_finalize, + type_info->class_data, + type_info->instance_size, + type_info->n_preallocs, + type_info->instance_init, + }; + + DEBUG("orig_gtk_im_context_xim_class_init: %p\n", orig_gtk_im_context_xim_class_init); + + gtk_type_im_context_xim = + orig_g_type_module_register_type(module, parent_type, type_name, + &hook_im_context_xim_info, flags); + + return gtk_type_im_context_xim; + } + + return orig_g_type_module_register_type(module, parent_type, type_name, type_info, flags); +} + diff --git a/sublime_text_3.sh b/sublime_text_3.sh deleted file mode 100755 index dfd4affaf2f9..000000000000 --- a/sublime_text_3.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# Please note that Sublime Text 3 for some reason opens an empty instance -# if the project you're trying to open is already open in another instance, -# instead of just giving it focus. - -SUBLIME_HOME=/opt/sublime_text_3 -BIN="${SUBLIME_HOME}/sublime_text" - -PID=$(pidof -o %PPID ${BIN} 2>/dev/null) -ARGS="--class=sublime-text" - -if [[ ${1:(-16)} == ".sublime-project" ]]; then - ARGS="${ARGS} --project" -fi - -if [[ -n ${PID} ]]; then - ${BIN} ${ARGS} "$@" -else - ${BIN} ${ARGS} "$@" & -fi - -# vim:set ts=2 sw=2 et: diff --git a/sublime_text_3_imfix.install b/sublime_text_3_imfix.install deleted file mode 100644 index 9fe0acd7c054..000000000000 --- a/sublime_text_3_imfix.install +++ /dev/null @@ -1,85 +0,0 @@ -post_install() { - # Note admin after install/update on how to change th update_check setting. - cat << _EOF - - ==> Sublime Text 3 Dev install/upgrade note: - ------------------------------------------------------------------------------ - - From Build 3065, the launch script 'subl3' is split into two launch scripts - 'sublime_text_3' and 'sublime_text_3_imfix'. 'sublime_text_3' would launch - the original executable 'sublime_text' without loading the library - 'libsublime-imfix.so'. - '/usr/bin/subl3' is a symlink to '/usr/bin/sublime_text_3_imfix' as default, - and you could re-link it to '/usr/bin/sublime_text_3' if you like. (Or re-link - it to '/usr/bin/vim' or '/usr/bin/emacs' if you like O(^_^)O) - - The desktop entry 'sublime_text_3.desktop' is also split into two desktop - entries 'sublime_text_3.desktop' and 'sublime_text_3_imfix.desktop'. Note that - 'sublime_text_3_imfix.desktop' is corresponding to 'sublime_text_3.desktop' - in previous version. - - To disable in-application reminders about new Sublime Text 3 Dev versions, add - the following setting to your User Preferences file: - - "update_check": false - - - - - The following is Simplified Chinese translation. - - ==> Sublime Text 3 开发版安装/升级注意事项: - ------------------------------------------------------------------------------ - - 从构建版本 3065 开始,运行脚本 "subl3" 分为两个运行脚本 "sublime_text_3" 和 - "sublime_text_3_imfix"。"sublime_text_3" 将不加载链接库 "libsublime-imfix.so" - 直接运行原来的可执行文件 "sublime_text"。 - "/usr/bin/subl3" 默认为一个指向 "/usr/bin/sublime_text_3_imfix" 的符号链接。 - 只要您愿意,您可以重新链接到 "/usr/bin/sublime_text_3"。(或者重新链接到 - "/usr/bin/vim" 或者 "/usr/bin/emacs",如果您愿意的话。O(^_^)O) - - 桌面图标 "sublime_text_3.desktop" 同样分为两个桌面图标 "sublime_text_3.desktop" - 和 "sublime_text_3_imfix.desktop"。请注意,"sublime_text_3_imfix.desktop" - 对应于之前版本的 "sublime_text_3.desktop"。 - - 要禁止 Sublime Text 3 开发版的应用内升级提醒,请在您的用户配置文件中添加以下 - 内容: - - "update_check": false - - - - - The following is Traditional Chinese translation. - - ==> Sublime Text 3 開發版安裝/升級注意事項: - ------------------------------------------------------------------------------ - - 從構建版本 3065 開始,啟動指令碼 "subl3" 分為兩個啟動指令碼 "sublime_text_3" - 和 "sublime_text_3_imfix"。"sublime_text_3" 將不載入連結庫 - "libsublime-imfix.so" 直接運行原來的可執行檔案 "sublime_text"。 - "/usr/bin/subl3" 預設為一個指向 "/usr/bin/sublime_text_3_imfix" 的符號連結。 - 只要您願意,您可以重新連結到 "/usr/bin/sublime_text_3"。(或者重新連結到 - "/usr/bin/vim" 或者 "/usr/bin/emacs",如果您願意的話。O(^_^)O) - - 桌面圖示 "sublime_text_3.desktop" 同樣分為兩個桌面圖示 "sublime_text_3.desktop" - 和 "sublime_text_3_imfix.desktop"。請注意,"sublime_text_3_imfix.desktop" - 對應於之前版本的 "sublime_text_3.desktop"。 - - 要禁止 Sublime Text 3 開發版的應用內升級提醒,請在您的用戶設定檔案中新增以下 - 內容: - - "update_check": false - - - - -_EOF -} - -post_upgrade() { - post_install $1 -} - -post_remove() { -} diff --git a/sublime_text_3_imfix.sh b/sublime_text_3_imfix.sh deleted file mode 100755 index db2a54b56454..000000000000 --- a/sublime_text_3_imfix.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# Please note that Sublime Text 3 for some reason opens an empty instance -# if the project you're trying to open is already open in another instance, -# instead of just giving it focus. - -SUBLIME_HOME=/opt/sublime_text_3 -LD_LIB="${SUBLIME_HOME}/libsublime-imfix.so" -BIN="${SUBLIME_HOME}/sublime_text" - -PID=$(pidof -o %PPID ${BIN} 2>/dev/null) -ARGS="--class=sublime-text" - -if [[ ${1:(-16)} == ".sublime-project" ]]; then - ARGS="${ARGS} --project" -fi - -if [[ -n ${PID} ]]; then - LD_PRELOAD=${LD_LIB} ${BIN} ${ARGS} "$@" -else - LD_PRELOAD=${LD_LIB} ${BIN} ${ARGS} "$@" & -fi - -# vim:set ts=2 sw=2 et: |