Skip to content

Commit

Permalink
Various updates for v4.6.7
Browse files Browse the repository at this point in the history
Various updates for v4.6.7, update DLL, fix typo, version, screenshots, readme, add more edge cases to data test script
  • Loading branch information
BdR76 committed Jun 25, 2024
1 parent 5e492b7 commit c92e6c2
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CSVLintNppPlugin/CsvLint/CsvGenerateCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
31 changes: 30 additions & 1 deletion CSVLintNppPlugin/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace Kbg.NppPluginNET
{
class Main
partial class Main
{
internal const string PluginName = "CSV Lint";
public static Settings Settings = new Settings();
Expand Down Expand Up @@ -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<int>(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

}

}
}

Expand Down
6 changes: 6 additions & 0 deletions CSVLintNppPlugin/PluginInfrastructure/ScintillaGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions CSVLintNppPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Binary file modified CSVLintNppPlugin/bin/Release-x64/CSVLint.dll
Binary file not shown.
Binary file modified CSVLintNppPlugin/bin/Release/CSVLint.dll
Binary file not shown.
Binary file modified docs/csvlint_add_new_column.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/csvlint_sort_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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
----------
Expand Down Expand Up @@ -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
34 changes: 23 additions & 11 deletions extra/generate_data99.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c92e6c2

Please sign in to comment.