끝글자 버그를 고칩시다 3 - scintilla
글쓴이: Hodong Kim@Google / 작성시간: 월, 2019/06/17 - 9:44오전
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:
제가 알고 있는 모든 끝글자 버그를 고쳤습니다.
제가 알고 있는 모든 끝글자 버그를 고쳤습니다.
막상 고치고 나니 2개 밖에 안 되는군요.
툴킷이나 라이브러리에 버그가 있으면 그걸 사용하는 많은 프로그램들이 영향을 받습니다.
이번에 고친거는 wxWidgets, scintilla 입니다.
이외 알고 있던 버그가 있었는데 다른 분들이 고치신 것 같습니다.
그외 버그로, ibus 입력기 자체에 있는 끝글자 버그는 ibus 설계 결함으로 발생하는 것이라, 버그 회피는 가능하지만 근본적으로 고치는 것은 불가합니다. 과거 ibus 프로젝트에도 패치를 보낸 바 있고 수용되지 않았고, 그래서 저는 nimf (구 다솜)를 만들어 사용 중입니다. nimf 를 ibus2 이렇게 해서 ibus 프로젝트에 패치를 보낼 수도 없고 ㅎㅎ ibus 고치다가 nimf (구 다솜)을 만들게 된 겁니다.
https://github.com/ibus/ibus/issues/1282#issuecomment-104839603
4년 전에 계획한 일들입니다.
scintilla 에 있는 한글 버그는 고쳐질 것
scintilla 에 있는 한글 버그는 고쳐질 것 같습니다. 제가 제공한 패치가 그대로 적용되는 것은 아니고 개발자님께서 수정해서 고쳐주실 것 같습니다. 각종 어플 한글 버그는 이렇게 고치시면 되겠습니다.
제가 욕먹을 짓도 많이 했는데 저를 타산지석, 반면교사로 삼아 뜻하신바 잘 이루시길 바랍니다.
Scintilla 개발자분께 감사드립니다.
Thanks to Scintilla developer.
끝글자 버그를 고칩시다 4 -
끝글자 버그를 고칩시다 4 - GtkEntry
https://kldp.org/node/161791 에서 계속 이어집니다.
댓글 달기