-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaegisub-langs.patch
48 lines (42 loc) · 1.8 KB
/
aegisub-langs.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From 717ff3885a94681ca62ca73e5587f5b8a27adad9 Mon Sep 17 00:00:00 2001
From: scx <[email protected]>
Date: Sun, 1 Sep 2019 23:40:47 +0200
Subject: [PATCH] Fix crashing when picking language
Aegisub crashes immediately after selecting any language
from the end of the list (above the 100th position).
This is because it can support no more than 100 languages.
This patch extends this limit up to 1000 languages (locales).
Fixes #131
---
src/subs_edit_ctrl.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/subs_edit_ctrl.cpp b/src/subs_edit_ctrl.cpp
index 4618ea409..d8d8c22f5 100644
--- a/src/subs_edit_ctrl.cpp
+++ b/src/subs_edit_ctrl.cpp
@@ -56,6 +56,10 @@
#include <wx/menu.h>
#include <wx/settings.h>
+// Maximum number of languages (locales)
+// It should be above 100 (at least 242) and probably not more than 1000
+#define LANGS_MAX 1000
+
/// Event ids
enum {
EDIT_MENU_SPLIT_PRESERVE = 1400,
@@ -73,7 +77,7 @@ enum {
EDIT_MENU_THESAURUS_SUGS,
EDIT_MENU_DIC_LANGUAGE = 1600,
EDIT_MENU_DIC_LANGS,
- EDIT_MENU_THES_LANGUAGE = 1700,
+ EDIT_MENU_THES_LANGUAGE = EDIT_MENU_DIC_LANGUAGE + LANGS_MAX,
EDIT_MENU_THES_LANGS
};
@@ -178,7 +182,7 @@ BEGIN_EVENT_TABLE(SubsTextEditCtrl,wxStyledTextCtrl)
EVT_MENU_RANGE(EDIT_MENU_SUGGESTIONS,EDIT_MENU_THESAURUS-1,SubsTextEditCtrl::OnUseSuggestion)
EVT_MENU_RANGE(EDIT_MENU_THESAURUS_SUGS,EDIT_MENU_DIC_LANGUAGE-1,SubsTextEditCtrl::OnUseSuggestion)
EVT_MENU_RANGE(EDIT_MENU_DIC_LANGS,EDIT_MENU_THES_LANGUAGE-1,SubsTextEditCtrl::OnSetDicLanguage)
- EVT_MENU_RANGE(EDIT_MENU_THES_LANGS,EDIT_MENU_THES_LANGS+100,SubsTextEditCtrl::OnSetThesLanguage)
+ EVT_MENU_RANGE(EDIT_MENU_THES_LANGS,EDIT_MENU_THES_LANGS+LANGS_MAX,SubsTextEditCtrl::OnSetThesLanguage)
END_EVENT_TABLE()
void SubsTextEditCtrl::OnLoseFocus(wxFocusEvent &event) {