Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
v1.3.1 bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HZZcode authored Oct 16, 2024
1 parent 53956a2 commit 04249ab
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 23 deletions.
42 changes: 21 additions & 21 deletions CMakeLists.txt.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 14.0.1, 2024-10-15T10:49:00. -->
<!-- Written by QtCreator 14.0.1, 2024-10-16T11:19:15. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down Expand Up @@ -109,14 +109,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Debug</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
Expand Down Expand Up @@ -166,14 +166,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
Expand Down Expand Up @@ -222,14 +222,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-RelWithDebInfo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
Expand Down Expand Up @@ -276,14 +276,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
Expand Down Expand Up @@ -331,14 +331,14 @@
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
-DCMAKE_BUILD_TYPE:STRING=MinSizeRel
-DCMAKE_GENERATOR:STRING=Ninja
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=MinSizeRel</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\14354\Documents\Qt Projects\MicrologicIDE\build\Desktop_Qt_6_7_2_MinGW_64_bit-MinSizeRel</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
Expand Down
23 changes: 22 additions & 1 deletion MicrologicIDE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void MicrologicIDE::mark(std::vector<int> errorList={}){

//keyword
for(const std::string& key:keys){
if(safe&&std::count(unsafeKeys.begin(),unsafeKeys.end(),key)) continue;
int t{};
for(const std::string& x:blankChars)
for(const std::string& y:blankChars)
Expand All @@ -246,6 +247,24 @@ void MicrologicIDE::mark(std::vector<int> errorList={}){
}
}

//unsafe keyword
if(safe){
for(const std::string& unsafeKey:unsafeKeys){
int t{};
for(const std::string& x:blankChars)
for(const std::string& y:blankChars)
while((t=text.find(x+unsafeKey+y))!=std::string::npos){
text.replace(t,x.size()+unsafeKey.size()+y.size(),x+unsafeKeyStart+unsafeKey+unsafeKeyEnd+y);
}
if(text.length()>=unsafeKey.length()){
if(text.substr(0,unsafeKey.size())==unsafeKey)
text.replace(0,unsafeKey.size(),unsafeKeyStart+unsafeKey+unsafeKeyEnd);
if(text.substr(text.size()-unsafeKey.size(),text.size())==unsafeKey)
text.replace(text.size()-unsafeKey.size(),unsafeKey.size(),unsafeKeyStart+unsafeKey+unsafeKeyEnd);
}
}
}

//mod name
for(const std::pair<std::string,std::pair<int,int>>& m:findMods(lines)){
std::string mod=m.first;
Expand Down Expand Up @@ -329,6 +348,7 @@ void MicrologicIDE::lightMode(){

errorStart="<span style=\"text-decoration: underline; text-decoration-color: red; white-space: pre;\">";errorEnd="</span>";
keyStart="<span style=\"color: orange; white-space: pre;\">";keyEnd="</span>";
unsafeKeyStart="<span style=\"color: red; white-space: pre;\">";unsafeKeyEnd="</span>";
numStart="<span style=\"color: aqua; white-space: pre;\">";numEnd="</span>";
modStart="<span style=\"color: purple; white-space: pre;\">";modEnd="</span>";

Expand All @@ -348,6 +368,7 @@ void MicrologicIDE::darkMode(){

errorStart="<span style=\"text-decoration: underline; text-decoration-color: red; white-space: pre;\">";errorEnd="</span>";
keyStart="<span style=\"color: orange; white-space: pre;\">";keyEnd="</span>";
unsafeKeyStart="<span style=\"color: red; white-space: pre;\">";unsafeKeyEnd="</span>";
numStart="<span style=\"color: aqua; white-space: pre;\">";numEnd="</span>";
modStart="<span style=\"color: purple; white-space: pre;\">";modEnd="</span>";

Expand All @@ -365,7 +386,7 @@ void MicrologicIDE::safeMode(){
makeMarks();
QAction *action = findChild<QAction*>("safeModeAction");
if(!action) return;
action->setText(safe?"关闭安全模式":"打开安全模式");
action->setText(safe?"安全模式-已开启":"安全模式-未开启");
}

int countInput(std::vector<std::string> lines){
Expand Down
1 change: 1 addition & 0 deletions MicrologicIDE.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class MicrologicIDE : public QMainWindow

std::string errorStart{},errorEnd{};
std::string keyStart{},keyEnd{};
std::string unsafeKeyStart{},unsafeKeyEnd{};
std::string numStart{},numEnd{};
std::string modStart{},modEnd{};

Expand Down
2 changes: 1 addition & 1 deletion MicrologicIDE.ui
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
</action>
<action name="safeModeAction">
<property name="text">
<string>打开安全模式</string>
<string>安全模式-未开启</string>
</property>
<property name="shortcut">
<string>Alt+S</string>
Expand Down

0 comments on commit 04249ab

Please sign in to comment.