diff --git a/CSVLintNppPlugin/CsvLint/CsvGenerateCode.cs b/CSVLintNppPlugin/CsvLint/CsvGenerateCode.cs index e6db9bc..da144c5 100644 --- a/CSVLintNppPlugin/CsvLint/CsvGenerateCode.cs +++ b/CSVLintNppPlugin/CsvLint/CsvGenerateCode.cs @@ -535,7 +535,7 @@ public static void GenerateSchemaIni(CsvDefinition csvdef) || ((col.DataType == ColumnType.DateTime) && (col.Mask != csvdef.DateTimeFormat)) ) notsup = true; } - if (notsup) comment += "\r\n; NOTE: some CSV Lint features are not supported by the ODBC Text driver, that is why these lines are are commented out"; + if (notsup) comment += "\r\n; NOTE: some CSV Lint features are not supported by the ODBC Text driver, that is why these lines are commented out"; // also add filename string FILE_NAME = Path.GetFileName(notepad.GetCurrentFilePath()); diff --git a/CSVLintNppPlugin/Main.cs b/CSVLintNppPlugin/Main.cs index 2788698..08e974a 100644 --- a/CSVLintNppPlugin/Main.cs +++ b/CSVLintNppPlugin/Main.cs @@ -16,7 +16,7 @@ namespace Kbg.NppPluginNET { - class Main + partial class Main { internal const string PluginName = "CSV Lint"; public static Settings Settings = new Settings(); @@ -193,14 +193,43 @@ internal static void RefreshFromSettings() { // check if cursor line currently has alpha value var editor = new ScintillaGateway(PluginBase.GetCurrentScintilla()); + var test123 = editor.GetCaretLineBackAlpha(); + + //if (test123 == Alpha.NOALPHA || test123 == Alpha.OPAQUE) if (editor.GetCaretLineBackAlpha() == Alpha.NOALPHA) { + // OLD OLD OLD OLD OLD // set cursor line transparency editor.SetCaretLineBackAlpha((Alpha)16 + 8); //editor.SetCaretLineBack(sCaretLineBack); editor.SetCaretLineBack(new Colour(0)); // Main.CheckConfigDarkMode() ? 0xFFFFFF : 0 editor.SetCaretLineLayer(Layer.UNDER_TEXT); // *IMPORTANT* + // OLD OLD OLD OLD OLD + + // // NEW NEW NEW NEW NEW + // //int safeoldcolor = static_cast(CallScintilla(view, SCI_GETELEMENTCOLOUR, SC_ELEMENT_CARET_LINE_BACK, 0)); + // int safeoldcolor = 0x808080; + // + // // set to transparent + // INotepadPPGateway notepad = new NotepadPPGateway(); + // int hiddenColor = notepad.IsDarkModeEnabled() ? 0xD0D0D0 : 0x202020; + // + // //ColourAlpha clr = new ColourAlpha(hiddenColor | ((int)SciMsg.SC_ALPHA_OPAQUE << 24)); + // ColourAlpha clr = new ColourAlpha(hiddenColor | (64 << 24)); + // + // editor.SetElementColor((int)SciMsg.SC_ELEMENT_HIDDEN_LINE, clr); + // + // editor.SetCaretLineBackAlpha((Alpha)16 + 8); + // + // //const intptr_t alpha = ((100 - caretLineTransp) * SC_ALPHA_OPAQUE / 100); + // int alpha = 24; + // ColourAlpha newclr = new ColourAlpha( (safeoldcolor & 0xFFFFFF) | (alpha << 24)); + // editor.SetElementColor((int)SciMsg.SC_ELEMENT_CARET_LINE_BACK, newclr); + // editor.SetCaretLineLayer(Layer.UNDER_TEXT); + // // NEW NEW NEW NEW NEW + } + } } diff --git a/CSVLintNppPlugin/PluginInfrastructure/ScintillaGateway.cs b/CSVLintNppPlugin/PluginInfrastructure/ScintillaGateway.cs index 1ca62a0..a509173 100644 --- a/CSVLintNppPlugin/PluginInfrastructure/ScintillaGateway.cs +++ b/CSVLintNppPlugin/PluginInfrastructure/ScintillaGateway.cs @@ -1308,6 +1308,12 @@ public Colour GetCaretLineBack() public void SetCaretLineBack(Colour back) { Win32.SendMessage(scintilla, SciMsg.SCI_SETCARETLINEBACK, back.Value, (IntPtr) Unused); + //Win32.SendMessage(scintilla, SciMsg.SC_ELEMENT_CARET_LINE_BACK, back.Value, (IntPtr)Unused); + } + + public void SetElementColor(int element, ColourAlpha clr) + { + Win32.SendMessage(scintilla, SciMsg.SCI_SETELEMENTCOLOUR, element, clr.Value); } /// diff --git a/CSVLintNppPlugin/Properties/AssemblyInfo.cs b/CSVLintNppPlugin/Properties/AssemblyInfo.cs index 08a49ec..477c9f5 100644 --- a/CSVLintNppPlugin/Properties/AssemblyInfo.cs +++ b/CSVLintNppPlugin/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.4.6.6")] -[assembly: AssemblyFileVersion("0.4.6.6")] +[assembly: AssemblyVersion("0.4.6.7")] +[assembly: AssemblyFileVersion("0.4.6.7")] diff --git a/CSVLintNppPlugin/bin/Release-x64/CSVLint.dll b/CSVLintNppPlugin/bin/Release-x64/CSVLint.dll index 2e3a87d..641a9f3 100644 Binary files a/CSVLintNppPlugin/bin/Release-x64/CSVLint.dll and b/CSVLintNppPlugin/bin/Release-x64/CSVLint.dll differ diff --git a/CSVLintNppPlugin/bin/Release/CSVLint.dll b/CSVLintNppPlugin/bin/Release/CSVLint.dll index c065387..c647b53 100644 Binary files a/CSVLintNppPlugin/bin/Release/CSVLint.dll and b/CSVLintNppPlugin/bin/Release/CSVLint.dll differ diff --git a/docs/csvlint_add_new_column.png b/docs/csvlint_add_new_column.png index 29fcad4..365165c 100644 Binary files a/docs/csvlint_add_new_column.png and b/docs/csvlint_add_new_column.png differ diff --git a/docs/csvlint_sort_data.png b/docs/csvlint_sort_data.png index 8bc4736..1bb75af 100644 Binary files a/docs/csvlint_sort_data.png and b/docs/csvlint_sort_data.png differ diff --git a/docs/readme.md b/docs/readme.md index 1098de7..78650b3 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -37,7 +37,7 @@ file it's still uncolored. There are four pre-defined color schemes you can select using the `Highlighting` button on the `Plugins > CSV Lint > Setttings` dialog. -At first time startup, the plug-in will select normal or darkmode color scheme, +At first time startup, the plug-in will select light or darkmode color scheme, depending on the Dark Mode setting in the Notepad++ `config.xml`. ![CSV Lint color styles for syntax highlighting](/docs/csvlint_color_styles.png?raw=true "CSV Lint plug-in color styles for syntax highlighting") @@ -324,6 +324,9 @@ current `Apply quotes` setting in the Reformat dialog. ![CSV Lint sort data dialog](/docs/csvlint_sort_data.png?raw=true "CSV Lint plug-in sort data dialog") +Sort on **value** to sort on the actual values, for example date value `31-01-2024` is lower than `01-12-2024`. +Sort on **length of value** to sort on the character length of the values, for example `xray` has a smaller length than `abdominal`. + Sort **ascending** start with low values, end with high values `0 -> 9, A -> Z` Sort **descending** start with high values, end with low values `Z -> A, 9 -> 0` @@ -644,7 +647,7 @@ and they are stored in a settings file `%USERPROFILE%\AppData\Roaming\Notepad++\ About ----- -An about window +An about dialog with the version number, contact information and a link to the documentation. Disclaimer ---------- @@ -676,5 +679,6 @@ History 02-may-2023 - v0.4.6.4 Comment character and dark mode support 04-jun-2023 - v0.4.6.5 Support enum/coded values and various updates 16-dec-2023 - v0.4.6.6 PowerShell support and various updates +25-jun-2024 - v0.4.6.7 Reformat bugfix, improved enumeration, sort on length BdR©2019-2024 Free to use - send questions or comments: Bas de Reuver - bdr1976@gmail.com diff --git a/extra/generate_data99.py b/extra/generate_data99.py index e6e9fcb..f6f7237 100644 --- a/extra/generate_data99.py +++ b/extra/generate_data99.py @@ -194,7 +194,7 @@ def random_lorem_string(c_min, c_max=None): else: val = ("%d.%s" % ( random.randint(1, 12), random_digits_string(2))) elif col == 42: - val = ("%d.%s" % ( random.randint(-9, 9), random_digits_string(3))).replace("0.", ".") + val = ("%d.%s" % ( random.randint(-9, 9), random_digits_string(random.randint(1, 3)))).replace("0.", ".") elif col == 43: val = ("%d.%s" % ( random.randint(-50, 20), random_digits_string(3))) elif col == 44: @@ -261,9 +261,11 @@ def random_lorem_string(c_min, c_max=None): elif col == 67: val = random.choices(["NEG", "POS", "readrror", "-"], weights=(30, 10, 2, 2))[0] elif col == 68: - val = random.choices(["NEG", "POS", "readrror", "-"], weights=(30, 10, 2, 2))[0] + if random.randint(1, 100) < 10: + val = random.choice(["Hb", "LDL", "HDL"]) elif col == 69: - val = random.choice(["Hb", "LDL", "HDL"]) + if random.randint(1, 100) < 10: + val = random_lorem_string(10, 50) elif col == 70: val = random.choices(["mmol/L", "µmol/L", "mg/mL", "g/L", "g/dL", "g/100mL", "g%"], weights=(30, 20, 20, 5, 5, 5, 2))[0] # random texts @@ -287,19 +289,27 @@ def random_lorem_string(c_min, c_max=None): val = random_lorem_string(0, 40) elif col == 80: val = random_lorem_string(0, 50) - # random texts + # various edge cases elif col == 81: - val = random_lorem_string(10) + if random.randint(1, 100) < 10: + val = random_lorem_string(10) elif col == 82: - val = random_lorem_string(10) + val = random_datetime_string("%d%m%y", -80) elif col == 83: - val = random_lorem_string(10) + val = "yes" elif col == 84: - val = random_lorem_string(10) + if random.randint(1, 100) < 95: + val = ("%d.%s" % ( random.randint(0, 1), random_digits_string(random.randint(1, 2)))) + else: + r_int = random.randint(0, 1) + val = ("%d.%sE-%02d" % ( random.randint(1, 9), random_digits_string(3), random.randint(5, 20))) elif col == 85: - val = random_lorem_string(10) + val = ("%02d.%02d.%d" % ( random.randint(1, 12), random.randint(1, 12), random.randint(curryear-10, curryear))) elif col == 86: - val = random_lorem_string(10) + if row < 95: + val = ("%02d/%02d/%d" % ( random.randint(1, 12), random.randint(1, 12), random.randint(curryear-10, curryear))) + else: + val = ("%02d/%02d/%d" % ( random.randint(13, 28), random.randint(1, 12), random.randint(curryear-10, curryear))) elif col == 87: val = random_lorem_string(10) elif col == 88: @@ -360,8 +370,10 @@ def random_lorem_string(c_min, c_max=None): colprefix = "decimal" elif 51 <= col <= 60: colprefix = "currency" - elif 71 <= col <= 89: + elif 71 <= col <= 80: colprefix = "text" + elif 81 <= col <= 89: + colprefix = "edgecase" elif col >= 90: colprefix = "random" else: diff --git a/readme.md b/readme.md index 7ea5c89..92cc930 100644 --- a/readme.md +++ b/readme.md @@ -54,8 +54,8 @@ want to install the plug-in manually: * Go to the [releases page](https://github.com/BdR76/CSVLint/releases) * Find the latest release -* 32bit version; unzip [CSVLint.dll (32bit)](../../releases/download/0.4.6.6/CSVLint_x86.zip/) to folder `.\Program Files (x86)\Notepad++\plugins\CSVLint\CSVLint.dll`. -* 64bit version; unzip [CSVLint.dll (64bit)](../../releases/download/0.4.6.6/CSVLint_x64.zip/) to folder `.\Program Files\Notepad++\plugins\CSVLint\CSVLint.dll`. +* 32bit version; unzip [CSVLint.dll (32bit)](../../releases/download/0.4.6.7/CSVLint_x86.zip/) to folder `.\Program Files (x86)\Notepad++\plugins\CSVLint\CSVLint.dll`. +* 64bit version; unzip [CSVLint.dll (64bit)](../../releases/download/0.4.6.7/CSVLint_x64.zip/) to folder `.\Program Files\Notepad++\plugins\CSVLint\CSVLint.dll`. * restart Notepad++ How to use it