SchematicFrame.hotkeys Newlines inconsistency


#1

I just had a peek at one of the configuration files of V4.0.7 and I noticed that:
~/.config/kicad/SchematicFrame.hotkeys
has only a single line of text with a lot of “\nshortcut”

“Save Schematic”\nshortcut “Ctrl+L”: “Load Schematic”\nshortcut “Ctrl+F”:

This seems to be an obvious error where the string “\n” probably sould have been an actual newline.
Anybody interested to check if his has been repaired in V5 ?


#2

It is not a bug, it’s supposed to be like that.


#3

So i’ll stop opening it in a text editor then. :slight_smile:
Weird, but not important.


#4

First: Sorry for renaming this thread twice.

In V4.0.7 I used:
EEschem -> Preferences -> Hotkeys -> Export Hotkeys
and saved the hotkeys to asdf.hotkeys
In the saved file the hotkeys are separated by real newlines instead of the “\n” string.

$hotkey list
[common]
shortcut “?”: “Help (this window)”
shortcut “F1”: “Zoom In”
shortcut “F2”: “Zoom Out”

Looks like “inconsistent behaviour” to me.
Is this also “intended” ?


#5

KiCad code has been written by many different developers over many years. I don’t think inconsistency is intended, it just happens. Config files tend to use an “ini file” format. Data files tend to use a more structured format with an ad hoc syntax. More recently, files use the s-expression syntax.

I wouldn’t worry about it.


#6

I am not really worrying about it, and I know it is a very minor issue.

I have however a bit of experience with programming.
Such inconsistenties however may lead to bug regressions.
Because the file formats are different, different code must be written to read and write those filed.

Do you have some experience in C? I know you (bobc) write scripts and such (python?) for KiCad.
As you probably know “\n” is used in C to indicate a newline in a string, and this is intercepted during stream operations to be replaced by the character sequence for a newline on the platform used.
When I saw the “\n” characters in a text file where a newline would be logical my first thought was that this was unintential, a “bug”. It can easily happen with for example:

printf( “This is a line of text.\n” );

Backslash is the start of an escape sequence in C and 2 backslashes are the escape sequence for a single backslash. Because of the double backslash the sequence ‘’ ‘n’ is written to the output instead of a newline.


#7

I have been writing code for over 30 years, including FORTRAN, Basic, Pascal, Modula-2, C, C++, C#, Python, assembler and a few others. I am quite familiar with bugs and how they happen :smiley:

Inconsistent code is a fact of life, unless there is an actual bug affecting the user, there is nothing to worry about.


#8

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.