• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A multilingual input method framework


Commit MetaInfo

Revision78a7b56a5a544bfdf4cd07aa82770fcc8b9c51f2 (tree)
Time2012-12-22 11:21:13
AuthorKIHARA Hideto <deton@m1.i...>
CommiterKIHARA Hideto

Log Message

Add function to shrink katakana string just after postfix katakana conversion.

* scm/tutcode.scm

- (tutcode-postfix-katakana-shrink): New function.

Change Summary

Incremental Difference

--- a/scm/tutcode.scm
+++ b/scm/tutcode.scm
@@ -3997,6 +3997,27 @@
39973997 (not (tutcode-context-katakana-mode? pc))))
39983998 (tutcode-context-set-state! pc 'tutcode-state-postfix-katakana))))))
39993999
4000+;;; 直前の後置型カタカナ変換を縮める
4001+;;; @param count 縮める文字数
4002+(define (tutcode-postfix-katakana-shrink pc count)
4003+ (let ((undo (tutcode-context-undo pc)))
4004+ (if (and (pair? undo)
4005+ (eq? (list-ref undo 0) 'tutcode-state-off)) ; 後置型変換
4006+ (let* ((commit-len (list-ref undo 1))
4007+ (yomi (list-ref undo 2))
4008+ (yomi-len (length yomi)))
4009+ (tutcode-postfix-delete-text pc commit-len)
4010+ (receive (kata hira)
4011+ (if (< count yomi-len)
4012+ (split-at yomi (- yomi-len count))
4013+ (values () yomi))
4014+ (let ((str (string-list-concat
4015+ (append (tutcode-katakana-convert kata #t) hira))))
4016+ (tutcode-commit pc str)
4017+ ;; shrinkを繰り返した際にcount文字ずつカタカナを縮められるように
4018+ (tutcode-undo-prepare pc 'tutcode-state-off
4019+ (string-list-concat kata) kata)))))))
4020+
40004021 ;;; 後置型カタカナ変換の対象文字列を取得する
40014022 ;;; @param yomi-len 指定された文字数。指定されてない場合は#f。
40024023 ;;; @return 取得した文字列(文字列の逆順リスト)