끝글자 버그를 고칩시다 3 - scintilla

Hodong Kim@Google의 이미지

https://kldp.org/node/161762 에 이어서 계속되는 글입니다.

scintilla 끝글자 버그

geany 에도 끝글자 버그가 있습니다. 이 역시 마우스 클릭할 때 reset 을 하지 않아서 발생하는 버그입니다.
geany 는 scintilla 를 사용합니다. scintilla 코드를 고치겠습니다.
패치는 아래와 같습니다. 버튼 클릭할 때, 항상 reset 하는 건 아니고 preedit string 가 있을 때만 im_context 을 reset 합니다.
이렇게 고치기 쉬운 버그가 바로 끝글자 버그입니다.

https://sourceforge.net/p/scintilla/bugs/2111/
https://github.com/geany/geany/pull/2197

hodong@debian:~/Downloads/geany_1.33.orig/geany-1.33$ git diff scintilla/gtk/ScintillaGTK.*
diff --git a/scintilla/gtk/ScintillaGTK.cxx b/scintilla/gtk/ScintillaGTK.cxx
index 3e48ed6..75c7169 100644
--- a/scintilla/gtk/ScintillaGTK.cxx
+++ b/scintilla/gtk/ScintillaGTK.cxx
@@ -665,6 +665,8 @@ void ScintillaGTK::Init() {
                caret.period = 0;
        }
 
+       g_signal_connect(PWidget(wMain), "button-press-event", G_CALLBACK(ScintillaGTK::OnButtonPress), NULL);
+
        for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast<TickReason>(tr + 1)) {
                timers[tr].reason = tr;
                timers[tr].scintilla = this;
@@ -2154,6 +2156,18 @@ gboolean ScintillaGTK::KeyRelease(GtkWidget *widget, GdkEventKey *event) {
        return FALSE;
 }
 
+gboolean ScintillaGTK::OnButtonPress(GtkWidget *widget, GdkEvent *event, gpointer user_data) {
+       ScintillaGTK *sciThis = FromWidget(widget);
+
+       if (sciThis->im_context) {
+               PreEditString pes(sciThis->im_context);
+               if (strlen(pes.str) > 0)
+                       gtk_im_context_reset(sciThis->im_context);
+       }
+
+       return FALSE;
+}
+
 #if GTK_CHECK_VERSION(3,0,0)
 
 gboolean ScintillaGTK::DrawPreeditThis(GtkWidget *, cairo_t *cr) {
diff --git a/scintilla/gtk/ScintillaGTK.h b/scintilla/gtk/ScintillaGTK.h
index a20f3bc..acb72bb 100644
--- a/scintilla/gtk/ScintillaGTK.h
+++ b/scintilla/gtk/ScintillaGTK.h
@@ -185,6 +185,7 @@ private:
        gboolean KeyThis(GdkEventKey *event);
        static gboolean KeyPress(GtkWidget *widget, GdkEventKey *event);
        static gboolean KeyRelease(GtkWidget *widget, GdkEventKey *event);
+       static gboolean OnButtonPress(GtkWidget *widget, GdkEvent *event, gpointer user_data);
 #if GTK_CHECK_VERSION(3,0,0)
        gboolean DrawPreeditThis(GtkWidget *widget, cairo_t *cr);
        static gboolean DrawPreedit(GtkWidget *widget, cairo_t *cr, ScintillaGTK *sciThis);
Forums: 
Hodong Kim@Google의 이미지

제가 알고 있는 모든 끝글자 버그를 고쳤습니다.
막상 고치고 나니 2개 밖에 안 되는군요.
툴킷이나 라이브러리에 버그가 있으면 그걸 사용하는 많은 프로그램들이 영향을 받습니다.
이번에 고친거는 wxWidgets, scintilla 입니다.
이외 알고 있던 버그가 있었는데 다른 분들이 고치신 것 같습니다.
그외 버그로, ibus 입력기 자체에 있는 끝글자 버그는 ibus 설계 결함으로 발생하는 것이라, 버그 회피는 가능하지만 근본적으로 고치는 것은 불가합니다. 과거 ibus 프로젝트에도 패치를 보낸 바 있고 수용되지 않았고, 그래서 저는 nimf (구 다솜)를 만들어 사용 중입니다. nimf 를 ibus2 이렇게 해서 ibus 프로젝트에 패치를 보낼 수도 없고 ㅎㅎ ibus 고치다가 nimf (구 다솜)을 만들게 된 겁니다.
https://github.com/ibus/ibus/issues/1282#issuecomment-104839603
4년 전에 계획한 일들입니다.

Hodong Kim@Google의 이미지

scintilla 에 있는 한글 버그는 고쳐질 것 같습니다. 제가 제공한 패치가 그대로 적용되는 것은 아니고 개발자님께서 수정해서 고쳐주실 것 같습니다. 각종 어플 한글 버그는 이렇게 고치시면 되겠습니다.
제가 욕먹을 짓도 많이 했는데 저를 타산지석, 반면교사로 삼아 뜻하신바 잘 이루시길 바랍니다.

Scintilla 개발자분께 감사드립니다.
Thanks to Scintilla developer.

Hodong Kim@Google의 이미지

끝글자 버그를 고칩시다 4 - GtkEntry
https://kldp.org/node/161791 에서 계속 이어집니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.