Commit Graph

178 Commits

Author SHA1 Message Date
Léa Saviot
0f2ac5b110 [escher/text_field] Fix std::min use 2020-06-04 14:50:05 +02:00
Léa Saviot
fd1b0e08ee [escher/text_field] Fix insertion size computation 2020-06-04 14:50:04 +02:00
Léa Saviot
eeb42f2544 [apps/code] autocompletionText uses the right text length
Before, there was no notion that the autocompleted text might not be a
null terminated string.
2020-06-04 14:50:03 +02:00
Romain Goyet
950862f8d0 Use std::min and std::max 2020-04-14 09:31:02 -04:00
Léa Saviot
9544f1c961 [apps/eschr] Don't copy an expr when editing it, if it is too long
Scenario: Create a new sequence which is the multiplication of a lot of
imaginary i. Save it (many multiplication sign are added), then try to
edit it again, in linear edition mode: the text overflows the buffer. If
we still copied it, it might get copied until the middle of a code point,
which would make the UTF8Decoder crash afterwards.
2020-02-18 10:06:36 +01:00
Émilie Feral
9c25fdb66e [escher] TextField: fix shouldFinishEditing to reset selection 2020-02-12 15:13:25 +01:00
Émilie Feral
4bcb3283c2 [escher] TextField: handleEventWithText: don't move the cursor position
if the text could not be inserted
2020-02-12 15:13:24 +01:00
Émilie Feral
0ffcf34eb7 [escher] TextField: make the handleEventWithText behaviour consistent:
when a text cannot be inserted because it overflows the buffer, don't
add anything

insertTextAtLocation already behaves like this but handleEventWithText
used to cap the inserted text which sometimes leads to a different
behaviour - it would insert a truncated text
2020-02-12 15:13:24 +01:00
Léa Saviot
ae3fa46191 [escher/text_field] Fix handling of \n
The buffer length did not take into account the \n removal. In fact, we
could just remove the \n while also removing the empty code points,
which is what we do now.
2020-02-12 15:13:24 +01:00
Léa Saviot
b29d014695 [escher/text_field] Fix removing of \n in insertTextAtLocation
Scenario: Copy a text with \n (for instance from a script), then paste
it in a script name -> if \n are replaed with \0 instead of just being
removed, there are problems with the extension
2020-02-12 15:13:23 +01:00
Ruben Dashyan
09e1c2eb8b [escher/text_input] insertTextAtLocation location parameter not const anymore 2020-02-12 15:13:23 +01:00
Léa Saviot
ce20f3f50f [escher/text_field] Fix empty Paste event
If there is no text in the clipboard and a Paste event in a text
field, the cursor moved at the beginning of the text
2020-02-12 15:13:20 +01:00
Léa Saviot
2fea9d61b6 [escher/text_field] Fix cut event text deletion
If there is a Cut event and the text field is edited but there is no
selection, the text is not stored in the clipboard but it was still
deleted.
2020-02-12 15:13:20 +01:00
Léa Saviot
66cf4ed83f [escher/text_field] Fix Cut / Clear redrawing 2020-02-12 15:13:20 +01:00
Léa Saviot
a42b52d10e [escher/text_area/field] When pasting, force cursor right of text 2020-02-12 15:13:18 +01:00
Léa Saviot
d9b284c1ec [escher/text_input] ShiftUp/Down selects whole textfield on left/right 2020-02-12 15:13:18 +01:00
Léa Saviot
cb53038909 [escher] Text input has alignment, not text field 2020-02-12 15:13:18 +01:00
Léa Saviot
e3d06d87fb [escher/text_field] Fix Cut event when selection 2020-02-12 15:13:18 +01:00
Léa Saviot
e161d42839 [escher/text_field] Reset selection after Cut event 2020-02-12 15:13:18 +01:00
Léa Saviot
3d6b0a2d20 [escher/text_field] Fix selection deletion
The draft text length should be modified accordingly
2020-02-12 15:13:18 +01:00
Léa Saviot
0e7809b5d9 [escher/text_field] Rename size -> length 2020-02-12 15:13:18 +01:00
Léa Saviot
efc8a238ea [escher] Rename deleteSelectedText -> deleteSelection 2020-02-12 15:13:17 +01:00
Léa Saviot
33b5f008a2 [escher/text_field] Selection 2020-02-12 15:13:17 +01:00
Léa Saviot
9f018eb9d9 [escher/view] setFrame and layoutSubviews can be forced 2020-02-12 15:13:15 +01:00
Émilie Feral
011142427a [esher] TextField: fix issues:
- when textFieldDidFinishEditing failed ("1+ln(-2)" in a scalar
entry for instance), the previous text was modified even if edition aborted
- The draft buffer was not reinitialized when overriding the draft text
buffer with a text event
2019-08-13 09:44:00 +02:00
Émilie Feral
12060e2ae7 [escher] TextField: all text fields use the same draft text buffer 2019-08-13 09:44:00 +02:00
Émilie Feral
2ecc566c2c [escher] TextField: when handling event with text, replace system
parenthesis by user parenthesis to switch from layout structure to
linear text.

When copying a layout and pasting it to a textfield, we add required
parentheses:

 2+1
----- serializes to ---> [2+1]/3 and is turned to (2+1)/3 before being
  3
handled by a textfield.
2019-08-08 17:22:02 +02:00
Émilie Feral
7a4ee746b2 [escher] TextField: call reinitDraftBuffer after edition is complete to
avoid erasing text that is required later.

Fix bug: OK handling on function list in linear mode did not copy the
function expression into the textfield before editing
2019-07-30 11:47:42 +02:00
Ruben Dashyan
e4ec398ecd [escher] InputEventHandler gets the app directly 2019-07-19 15:06:25 +02:00
Romain Goyet
45875dd642 [escher] Make app() a global function
This way it can easily be reached by anyone, including non-responders.
And it can easily be overwritten in namespaced apps.
2019-07-19 15:06:25 +02:00
Léa Saviot
cc8403e020 [escher/text_input] Factorize and clean handleEvent Right and Left 2019-06-21 14:30:14 -04:00
Léa Saviot
5a8596acd7 [ion/utf8_helper] Put default parameter in RemovePreviousGlyph 2019-06-21 14:30:14 -04:00
Léa Saviot
b696668422 [escher/text_field] Fix cursor navigation on combining code points 2019-06-21 14:30:14 -04:00
Léa Saviot
5f549b514e [escher] Fix backspace on utf8 combining code point 2019-06-21 14:30:14 -04:00
Léa Saviot
a7d8160ee0 [escher/text_field] Add missing cursor location update
Fixes the scenario: go to statistics, press the root key, then the XNT
key -> crash
2019-05-03 15:54:22 +02:00
Léa Saviot
5316372d72 [escher/text_field] When fetching XNT code point, text is draftText 2019-05-03 15:54:22 +02:00
Léa Saviot
07b22f44d2 [escher/text_field] Fix rect dirtying in setText
The content of the buffers might no be initialized before the setText,
so we cannot use reloadRectFromPosition, as it requires to perform
stringSize, which needs valid content.
2019-05-03 15:53:20 +02:00
Léa Saviot
cbb1055218 [escher] Fix TextField::ContentView::setEditing 2019-05-03 15:53:20 +02:00
Léa Saviot
b2a97cfc7a [escher] Fix buffer choice in TextField::glyphFrameAtPosition 2019-05-03 15:53:20 +02:00
Léa Saviot
e338577793 [unicode] Clean decoder use 2019-05-03 15:53:20 +02:00
Léa Saviot
c476ea5380 [escher/text_field] Fix removeCodePoint rect dirtying 2019-05-03 15:53:19 +02:00
Léa Saviot
34fc647ccd [escher/text_field] Code cleaning 2019-05-03 15:53:19 +02:00
Léa Saviot
39f6f4f5bb Remove compilation warnings 2019-05-03 15:53:19 +02:00
Léa Saviot
f9fbcabb30 [escher/ion] Factorize code for removing a code point in text field/area 2019-05-03 15:53:19 +02:00
Léa Saviot
bd2ea41fbe [apps/escher] Rename cursorTextLocation as cursorLocation 2019-05-03 15:53:19 +02:00
Léa Saviot
7b5c51b3c3 [escher] Fix textfield edition 2019-05-03 15:53:19 +02:00
Léa Saviot
bbb10f1993 [ion/kandinsky] Move unicode to ion 2019-05-03 15:53:19 +02:00
Léa Saviot
5c39cab73e [escher] Fix text inputs so they use UTF8 2019-05-03 15:53:19 +02:00
Léa Saviot
41afa92f10 [unicode] Use the UTF8Decoder to scan const char * 2019-05-03 15:53:19 +02:00
Léa Saviot
65e5adafac Remove Ion::Charset 2019-05-03 15:53:19 +02:00