c-smile / sciter-sdk

Sciter is an embeddable HTML/CSS/scripting engine
http://sciter.com
Other
2.11k stars 224 forks source link

Everything that's wrong with plaintext #93

Closed Mikanoshi closed 5 years ago

Mikanoshi commented 6 years ago

~1. In 6175:~ 1 ~2.~

<html>
<head>
<script type="text/tiscript">
    function self.ready() {
        var p = $(plaintext);
        p.selection.select([bookmark: p.first.firstNode, 1, false]);
        p.execCommand("edit:insert-text", "\n2\n\n4\n");
    }
</script>
</head>
<body>
    <plaintext>15</plaintext>
</body>
</html>

Result is

1
2
5
4

instead of

1
2

4
5

If inserted string is \n2\n3\n4\n then last new line after 4 is missing. This code works:

p.execCommand("edit:insert-break");
p.execCommand("edit:insert-text", "2");
p.execCommand("edit:insert-break");
p.execCommand("edit:insert-break");
p.execCommand("edit:insert-text", "4");
p.execCommand("edit:insert-break");

~3. Caret always disappears after opening context menu. https://sciter.com/forums/topic/caret-coordinates/#post-57569 And how to set input focus to plaintext programmatically without selecting a specific text node, just make caret appear at the same position it was before input focus was removed?~

~4. What's going on with the caret? Why it can't stand still? :) https://sciter.com/forums/topic/change-event-is-unreliable/#post-57593~

c-smile commented 6 years ago

What's wrong with No.1 ?

Mikanoshi commented 6 years ago

Ctrl+Z

Mikanoshi commented 6 years ago

Shortcut is still without +


Too soon :) Inserting text with new lines misplaces the last one (or all?), e.g. "1\n\n2" results in
```
1

2

```
Mikanoshi commented 6 years ago

Also when pasting text with new lines it just removes them all.

Mikanoshi commented 6 years ago

&platform-cmd-mod; returns different strings on 6143 (Ctrl+) and on 6172 and above (Ctrl). Windows 10 1803

c-smile commented 6 years ago

6172 is the correct one. &platform-cmd-mod; yields to CTRL (Windows,Linux) or to on MacOS. + must not be included.

Mikanoshi commented 5 years ago

6195:

Mikanoshi commented 5 years ago

Both above problems remain in 4.2.5.0 (only End + pasting text without new lines was fixed).

Mikanoshi commented 5 years ago

4.2.5.1:

Mikanoshi commented 5 years ago

4.2.6.1:

Mikanoshi commented 5 years ago

4.2.6.8:

Mikanoshi commented 5 years ago

4.2.6.10:

~Doing this on an empty plaintext made above commands work, but not anymore. if (pt.selection.caret === null) pt.selection.select(pt, #content);~