dpradov / keynote-nf

Tabbed notebook with RichText editor, multi-level notes and strong encryption.
Mozilla Public License 2.0
252 stars 56 forks source link

Enable Tab Stop configuration (trying to match TAB with four spaces) #615

Open mdnava opened 1 year ago

mdnava commented 1 year ago

Is it possible to fix the tab size when enabling "Use tab character" in note properties?

Currently it seems to have five (5) character spaces instead of four (4).

dpradov commented 1 year ago

Hello, I don't reproduce your problem. Please provide an example that makes what you are saying clear.

mdnava commented 1 year ago

@dpradov .. Example:

2023-09-14 12 02 34

dpradov commented 1 year ago

Sorry, but I don't understand the problem. If the third line indented without using TAB character includes 4 characters, as defined in your note properties. Where the problem is? imagen

The visible width of a tab character does not have to match that of four characters. This will depend on the type of font as well as the definition of the tab stops (which is currently not configurable in KNT). Example:

imagen

imagen

mdnava commented 1 year ago

The visible width of a tab character does not have to match that of four characters. This will depend on the type of font as well as the definition of the tab stops (which is currently not configurable in KNT).

I understand that. However, for any monospace font, I would expect/hope for the TAB to be consistent usually with a four character space (or sometimes two or eight spaces). In my example I'm using "Consolas" font, which is a monospace font. Also, in my example, the second and third lines in the list have the same four character space, just to make the point.

I discovered KeyNote NF I think less than a year ago and I think I'll keep sing it. I had been using and changing several other programs for many years, but this one feels exactly what I need. However, the tab issue made me somewhat crazy.

I have partially solved this issue with a workaround, by using AutoHotkey. So I've set up the following AHK hotkeys: TAB » Increase Left Indent x 2 (set as hotkey "CTRL+RIGHT" in KeyNote) SHIFT+TAB » Decrease Left Indent x 2 (set as hotkey "CTRL+LEFT" in KeyNote)

2023-09-14 13 58 21

That gives me some consistency, but is not perfect.

I just tried other programs to see how TAB behaves:

2023-09-14 13 17 53 Open Sans

2023-09-14 13 51 00

2023-09-14 13 21 55 Consolas

2023-09-14 13 32 55

2023-09-14 13 46 24

So I suppose for a RTF editor I should not expect TAB spacing consistency, even for monospaced fonts..

dpradov commented 1 year ago

So I suppose for a RTF editor I should not expect TAB spacing consistency, even for monospaced fonts..

Logically. And it's not the editors' problem. It is simply a normal thing about the coexistence of the TAB character with spaces. Having a tab stop match exactly 4 spaces is something that can be achieved by setting the tab stops in line with a given font. As far as I know, in programs like Notepad++, Notepad2e, etc., based on the Scintilla editor, it is not possible to define the type of font to use. The size can be changed, but not the family, for example. Or maybe yes, and I haven't seen it. It could be fulfilled, even when changing it, if the program automatically takes care of adjusting the tab stops depending on each specific monospace font.

In editors based on Rich Text Format (RTF) it is impossible to ensure that this equality is always met. As I have indicated, it depends on the type of font and where the tab stops have been set, which is currently not configurable in KeyNote (I may end up including it), but nothing prevents combining different fonts, of different sizes, etc., in the same line, and that does not mean that the tab stops should be changed...

I have partially solved this issue with a workaround, by using AutoHotkey

Too much complication, IMHO I would just make sure not to combine TAB characters with spaces, depending on what you are writing. In cases where it is important to avoid indentation mismatches due to the presence of both spaces or tabs (for example, writing code, which is common and annoying), I would make sure to have the "Use Tab character" option disabled. For example, this is how I have the Notepad++ program configured, in which I often help myself at work to write code, such as PL/SQL, for example. Although in Notepad++ 1 TAB matches 4 characters perfectly, if I don't make sure to use spaces instead of TABs, I find that that same file, from SQLDeveloper, for example, looks terrible.

imagen

mdnava commented 1 year ago

Logically. And it's not the editors' problem. It is simply a normal thing about the coexistence of the TAB character with spaces. Having a tab stop match exactly 4 spaces is something that can be achieved by setting the tab stops in line with a given font. As far as I know, in programs like Notepad++, Notepad2e, etc., based on the Scintilla editor, it is not possible to define the type of font to use. The size can be changed, but not the family, for example. Or maybe yes, and I haven't seen it. It could be fulfilled, even when changing it, if the program automatically takes care of adjusting the tab stops depending on each specific monospace font.

Ok, But just for the record. All text editors using monospaced fonts are consistent with tab and spaces, as long as the tab size is set properly. And yes, font families can be changed in both Notepad2 and Notepad++. I attach samples.

2023-09-14 16 12 14

2023-09-14 16 12 56

2023-09-14 16 13 45

2023-09-14 16 14 08

2023-09-14 16 14 26

In editors based on Rich Text Format (RTF) it is impossible to ensure that this equality is always met. As I have indicated, it depends on the type of font and where the tab stops have been set, which is currently not configurable in KeyNote (I may end up including it), but nothing prevents combining different fonts, of different sizes, etc., in the same line, and that does not mean that the tab stops should be changed...

Ok I understand. I always known that this applied to variable-width fonts, but it made sense to me that monospaced fonts should not have this problem, the space is fixed anyway. It's true that a RTF editor can have multiple fonts and styles within the same document, but it seems logic to me that if three lines have the same monospace font, a tab size should match the same four spaces for that same font.

——————————————— Please consider including tab stops configuration.. or for it to match the same as tab size. ———————————————

I have partially solved this issue with a workaround, by using AutoHotkey

Too much complication, IMHO I would just make sure not to combine TAB characters with spaces, depending on what you are writing. In cases where it is important to avoid indentation mismatches due to the presence of both spaces or tabs (for example, writing code, which is common and annoying), I would make sure to have the "Use Tab character" option disabled. For example, this is how I have the Notepad++ program configured, in which I often help myself at work to write code, such as PL/SQL, for example. Although in Notepad++ 1 TAB matches 4 characters perfectly, if I don't make sure to use spaces instead of TABs, I find that that same file, from SQLDeveloper, for example, looks terrible.

Jeje.. yes I know. I was actually doing that for a while (using spaces). But I'm a TAB person. Can't quite adapt to spaces. That's been my main complain with JSON and PYTHON. We could make a long interesting talk about it, but for me is simply faster to use and remove, and a matter of habit.

Best regards!

dpradov commented 1 year ago

And yes, font families can be changed in both Notepad2 and Notepad++. I attach samples.

As I said, surely it is possible and I haven't looked hard enough for it. But at least in Notepad2 and Notepad++ I don't see where it can be changed. What I see from your screenshots is that the font type seems the same, perhaps with a slight difference in size. I was hoping you would show me two screenshots of the same program with quite different fonts. But hey, it doesn't matter.

Please consider including tab stops configuration.. or for it to match the same as tab size.

Don't worry, I'll keep that in mind. In fact, among my list of improvements was including allowing the configuration of tab stops.

If you like, I can rename the subject from "Fix tab spaces when "Use tab character" is enabled" to "Enable Tab Stop configuration (trying to match TAB with four spaces)"

mdnava commented 1 year ago

@dpradov sorry for the delay..

I was hoping you would show me two screenshots of the same program with quite different fonts.

Sure. Any editor or terminal I can think of allows to change its default font. I tend to use a version of the Consolas font (patched with the latest NerdFonts symbols) for almost everything that works best with monospaced fonts.

Here are NPP, Notepad2, and other picks:

2023-09-21 12 00 11

2023-09-21 12 00 56

2023-09-21 11 59 12

2023-09-21 11 44 57

2023-09-21 11 58 53

I also attach the font "Consolas NF3", of which I usually do the patching myself, in case you wanna try it.

ConsolasNF3-MN.zip

Don't worry, I'll keep that in mind. In fact, among my list of improvements was including allowing the configuration of tab stops.

Awesome!

If you like, I can rename the subject from "Fix tab spaces when "Use tab character" is enabled" to "Enable Tab Stop configuration (trying to match TAB with four spaces)"

Sure, anything that can help!

Best regards!

dpradov commented 1 year ago

Here are NPP, Notepad2, and other picks

Thanks for all the example and for recommendation of the font "Consolas NF3". I have tried changing the font type in Notepad++ and yes, it maintains the equality 1 TAB = 4 spaces.

dpradov commented 11 months ago

What about multi-cursor feature

Hello, could you detail what you are referring to and what relationship it has to this issue?