Ckeditor 5 removing line-breaks from copying data - copy-paste

I use classic default ckeditor 5 build.
The problem is if I copy from notepad text like:
1
2
3
In editor I give result:
1 2 3
If I copy next text:
1
2
3
In editor I give:
1
2
3
Why ckeditor removing one line-break per line ?

You encountered something that can be considered a bug or a missing feature.
Single \n line characters, which are converted to <br> on paste are lost due the fact that CKEditor 5 doesn't support soft-line breaks yet.
On the other hand, not everyone need to load the soft-line break feature so, even if we'll introduce it, the problem will occur for these users. Hance, perhaps the plain text to HTML conversion should work differently. Or be configurable.
More info https://github.com/ckeditor/ckeditor5/issues/766

Related

Spyder IDE problem: Every indented statement throws an indentation error

I'm getting the "IndentationError: expected an indented block" error in every indented statement, no matter how simple. I've really hit a wall, so any help would be much appreciated.
I've gone through many similar questions on SO and to the best of my ability have taken care that I have the correct indentation in my code (and that I'm not mixing tabs and spaces).
With each of the below statements, I get the same "expected an indented block" error behind the first line's colon. I use tabs in Spyder, but will use 4 spaces to indent here.
if 3 + 5 > 0:
print("8")
Throws the error:
In [6] if 3 + 5 > 0:
File "C:\Users\..\AppData\Local\Temp\ipykernel_12028\2022076979.py", line 1
if 3 + 5 > 0:
^
IndentationError: expected an indented block
Same error for:
for i in range(1,11):
print(i)
And also for:
def iris_data():
print("hello")
All three statements run as given in the PyCharm IDE (as well as IDLE), so this seems to be an issue with Spyder's settings (or maybe installation?).
I like using Spyder as an IDE, so I'm really hoping someone has any idea what is causing these errors. Thanks.
I was running only the line by putting the cursor in/on it and pressing F9.
What I wanted to do was run the cell by pressing ctrl+ return, or alternatively, select the entire piece of code I want to run and press F9.
It's such a stupid mistake that I couldn't find anything on Google or Stack Overflow.
Hope this maybe helps out another absolute beginner.

GNUCobol compiled program counts one more record than expected

I'm learning COBOL programming and using GNUCobol (on Linux) to compile and test some simple programs. In one of those programs I have found an unexpected behavior that I don't understand: when reading a sequential file of records, I'm always getting one extra record and, when writing these records to a report, the last record is duplicated.
I have made a very simple program to reproduce this behavior. In this case, I have a text file with a single line of text: "0123456789". The program should count the characters in the file (or 1 chararacter long records) and I expect it to display "10" as a result, but instead I get "11".
Also, when displaying the records, as they are read, I get the following output:
0
1
2
3
4
5
6
7
8
9
11
(There are two blank spaces between 9 and 11).
This is the relevant part of this program:
FD SIMPLE.
01 SIMPLE-RECORD.
05 SMP-NUMBER PIC 9(1).
[...]
PROCEDURE DIVISION.
000-COUNT-RECORDS.
OPEN INPUT SIMPLE.
PERFORM UNTIL SIMPLE-EOF
READ SIMPLE
AT END
SET SIMPLE-EOF TO TRUE
NOT AT END
DISPLAY SMP-NUMBER
ADD 1 TO RECORD-COUNT
END-READ
END-PERFORM
DISPLAY RECORD-COUNT.
CLOSE SIMPLE.
STOP RUN.
I'm using the default options for the compiler, and I have tried using 'WITH TEST {BEFORE|AFTER}' but the result is the same. What can be the cause of this behavior or how can I get the expected result?
Edit: I tried using an "empty" file as data source, expecting a 0 record count, using two different methods to empty the file:
$ echo "" > SIMPLE
This way the record count is 1 (ls -l gives a size of 1 byte for the file).
$ rm SIMPLE
$ touch SIMPLE
This way the record count is 0 (ls -l gives a size of 0 bytes for the file). So I guess that somehow the compiled program is detecting an extra character, but I don't know how to avoid this.
I found out that the cause of this behavior is the automatic newline character that vim seems to append when saving the data file.
After disabling this in vim this way
:set binary
:set noeol
the program works as expected.
Edit: A more elegant way to prevent this problem, when working with data files created from a text editor, is using ORGANIZATION IS LINE SEQUENTIAL in the SELECT clause.
Since the problem was caused by the data format, should I delete this question?

How do I "extend" the outer interpreter?

In different Forths, how do I customize the interpreter?
For example, in SP-Forth the interpreter always write the stack content and always make a CR/LF before printing:
1 2 3
Ok ( 1 2 3 )
.s
1 2 3 Ok ( 1 2 3 )
I would like to see:
1 2 3 ok
.s 1 2 3 ok
And generally, I would like to be able to define new data inputs like
4-3i
{1,2,3,4,5}
The interpreter should then store the data as I defined in the extension. Also, on errors I would like soft stacks and variables to be reset.
Any ideas?
In different Forth systems there are different ways for customization.
In SP-Forth you can define another action for OK vector. For example, to avoid printing data stack state:
: OK2 ( -- ) STATE # IF EXIT THEN ." ok" CR ;
' OK2 TO OK
\ see the original definition in src/compiler/spf_translate.f
Though, it is difficult to avoid CRLF before "ok" in Windows console application since this CRLF is part of the text that you input.
Regarding a new data formats there is Recognizers RfD. It is implemented in some Forth systems, but not in SP-Forth yet.
In SP-Forth you can use NOTFOUND mechanism to add custom word format (words interpreter).

NotePad++ Changing Few Number Entries

Here is a simple lists where I like to change the numbers: the entries are as below and it got over 300 entries like it
tom112
smith113
harry114
linda115
cindy106
samantha147
It need to be changed to
tom212
smith213
harry214
...and so on.
Please assist using notepad++ regular expression.
Thanks.
Assuming it's just a matter of replacing a name followed by a number starting with 1 with the same number but starting with 2 instead:
Ctrl + H for search & replace.
Check Regular expression under Search Mode.
Next to Find what type or copy in ([a-zA-Z]+)1([0-9]+).
Next to Replace with type or copy in \12\2.
Click Replace All and that should do it.
Add any other characters that might appear in the name before the number inside the first set of brackets with a-zA-Z.

Joe's own editor - how to change the tab size

I'm having trouble changing the tab size in Joe.
I have copied joerc to $HOME and have edited the -tab line to -tab 4 but this hasn't changed the option in Joe. Also the number 4 is green instead of blue when I edit joerc so I think its reading it wrong.
The real solution is:
Create a file $HOME/.joerc (NOT .joe as at least the Debian joerc suggests!)
FIRST LINE must be :include /etc/joe/joerc
Then, a line containing just a * and a newline character
Then, -tab 4 and -istep 4, each on a single line.
Add a blank line at the end.
You may also add further options with other masks.
I've wasted about 20 mins trying to set tab size too. Here is the solution:
I. Open:
/etc/joe/joerc
II. Find row containing -tab nnn and change it to:
-tab 4
(I assume that you want to change tab size to 4. If you want different value, please replace all the 4s with your value)
III. Find -istep nnn and change it to:
-istep 4
IV. Save & exit
This will set tab size 4 for files WITHOUT extension. If you want to change tab size for files with common extensions like *.java:
I. open /etc/joe/ftyperc
II. Find your extension, for example *.java. Initially it looks like:
JAVA
*.java
-autoindent
-syntax java
-smarthome
-smartbacks
-purify
-cpara >#!;*/%
III. You have to comment (insert tab before it) -autoindent and add -istep 4 bellow -cpara. It should look like:
JAVA
*.java
-autoindent
-syntax java
-smarthome
-smartbacks
-purify
-cpara >#!;*/%
-istep 4
In case anyone else runs into this, I am running an ancient version of joe on AIX and after some painful trial and error it turned out that -smartbacks was the problem for me. I commented that line out and tabs work, put it back and they go back to 2. Probably fixed in a later version, but hopefully this helps someone else with the same problem.
JAVA
*.java
-spaces
-tab 4
-istep 4
-indentc 32
-autoindent
-syntax java
-smarthome
-smartbacks
-purify
Each time the tab key is pressed (using joe 4.6) it inserts 4 spaces after having followed those steps:
Execute sudo joe /etc/joe/joerc
Find the row containing -tab nnn Tab width, change it to -tab 4 Tab width and make sure that there is no whitespace at its left side.
A few lines down, find the row containing -spaces TAB inserts spaces instead of tabs and make sure that there is no whitespace at its left side.
Save and exit
This works here for files without extension, for .cpp files, for .java files, for .c files, for .txt files, etc.

Resources