summaryrefslogtreecommitdiff
path: root/gtk/gtktextview.c
Commit message (Collapse)AuthorAgeFilesLines
* tetview: Stop using gtk_widget_get_allocationMatthias Clasen2023-04-281-6/+2
|
* textview: Reset press counter if double/triple clicking on a different lineCarlos Garnacho2023-04-121-0/+20
| | | | | | | | | | If we click close enough between lines, and with the maximum distances applied by GtkGestureClick we could jump between lines when handling double/triple click for word/line selection. Ensure that the whole operation stays in the same line and reset the gesture/counter if we do move between lines, so we start from scratch in the new line.
* textview: Handle a return valueMatthias Clasen2023-04-071-1/+2
|
* docs: Fix various broken linksBilal Elmoussaoui2023-03-271-2/+2
|
* Deprecate gtk_widget_translate_coordinatesMatthias Clasen2023-03-251-6/+8
| | | | | | | Update all (non-deprecated) callers to use gtk_widget_compute_point instead. Fixes: #5697
* docs: Improve markup for keysMatthias Clasen2023-03-241-19/+21
| | | | | Consistently use <kbd>x</kbd> to render keys in the docs and use + for key combinations.
* gtk: Stop using g_sliceMatthias Clasen2023-03-141-8/+8
|
* Update TextTag and TextView indent DocumentationJacob Mealey2023-02-121-0/+5
| | | | Change the documentation for both to be in line with Pango documentation specifically regarding hanging indentation.
* gtktextview: Avoid calling gdk_rgba_free for NULL valuesMarco Trevisan (TreviƱo)2023-02-031-6/+3
| | | | Related to glib#2908
* gtktextview: Avoid gtk_gesture_set_sequence_state()Carlos Garnacho2023-02-021-6/+6
| | | | | Use gtk_gesture_set_state() as this widget does not need specific knowledge on the sequence being used for interaction.
* Merge branch 'show-hide-cleanup' into 'main'Matthias Clasen2022-11-291-14/+14
|\ | | | | | | | | gtk: Stop using gtk_widget_show/hide See merge request GNOME/gtk!5273
| * gtk: Stop using gtk_widget_show/hideMatthias Clasen2022-11-281-14/+14
| | | | | | | | | | | | | | gtk_widget_set_visible and gtk_window_present are better alternatives, and calling gtk_widget_show on newly created widgets is no longer necessary anyway.
* | gtktextview: Invoke OSK on button/touch taps that move/undo selectionCarlos Garnacho2022-11-281-4/+32
| | | | | | | | | | | | | | | | | | If the ::release handler is invoked, the press/release happened without drags in between. Additionally check that there is no selection at all. This makes OSK invoked on taps that move the caret around, while tapping in the selection invokes edition popup and text handles without bringing in the OSK.
* | gtktextview: Claim drag gesture after an actual selection changeCarlos Garnacho2022-11-281-9/+13
|/ | | | | | | | This way, the drag gesture lets the click gesture ::release handler happen if there was no actual changes to the selected text (i.e. too short drags). This matches the ::release handler behavior match the situations in which the OSK was being invoked by the wayland GtkIMContext.
* textview: Stop using gtk_style_context_save_to_nodeMatthias Clasen2022-10-121-7/+3
|
* textview: Stop using gtk_snapshot_render apiMatthias Clasen2022-10-121-11/+11
| | | | The gtk_snapshot_render api is deprecated, so avoid using it.
* Deprecate gtk_snapshot_render apisMatthias Clasen2022-10-121-0/+3
| | | | | | | | | | Move the implementations from gtksnapshot.c to gtk/deprecated/gtkrender.c and deprecated these functions. We want to get rid of them. These functions are still used in some of our widgetry, so use G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS around them.
* gtk: Rename some private headersMatthias Clasen2022-10-051-2/+2
| | | | | Improve the consistency of our private header naming, by add 'private' to a bunch of them.
* Merge branch 'wip/carlosg/shuffle-reset-take2' into 'main'Matthias Clasen2022-09-281-4/+2
|\ | | | | | | | | | | | | gtkimcontextwayland: Shuffle full resets after IM changes Closes #5200 See merge request GNOME/gtk!5050
| * gtkimcontextwayland: Shuffle full resets after IM changesCarlos Garnacho2022-09-241-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Doing reset() on the text widgets after commit and delete_surrounding is still too eager for some IMs (e.g. those that expect being able to commit text while keeping a preedit buffer shown). However, reset() is more of a "synchronize state" action on Wayland, and it is still desirable to do that after changes that do come from the IM (e.g. requesting the new surrounding text and cursor/anchor positions). Notably here, the text_input protocol may still come up with a preedit string after this state synchronization happens. Shuffle the code so that the text widgets do not reset() the IM context after text is deleted or committed, but the Wayland IM does apply its practical effects after these actions happen. This keeps the Wayland IM fully up-to-date wrt text widget state, while not altering the ::commit and ::delete-surrounding-text behavior for other IM context implementations. Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5200 Fixes: 5b78fe2721 (gtktextview: Also reset IM context after IM...) Fixes: 7c0a395ff9 (gtktext: Also reset IM context after IM...) Fixes: 52ac71b972 (gtktextview: Shuffle the places doing IM reset) Fixes: 9e29739e66 (gtktext: Shuffle the places doing IM reset)
* | Drop gtkintl.hMatthias Clasen2022-09-241-1/+1
|/ | | | | Include gtkprivate.h for I_() and glib-i18n.h for gettext macros.
* gtktextview: Also reset IM context after IM surrounding text deletionCarlos Garnacho2022-09-061-2/+3
| | | | | | | | | When the IM commands the GtkText to delete text, the cursor position would change, and so would the surrounding text. Reset the IM context so that these updates are properly picked up by the IM. Fixes backspace key behavior in the GNOME Shell OSK, since that relies on the surrounding text being properly updated for the next iteration.
* gtktext: Avoid early IM reset on updatesCarlos Garnacho2022-09-061-9/+1
| | | | | | | | | | | | | | | | | | Resetting the IM on IM updates is too eager and indeed the simple IM context doesn't like that this happens in the middle of dead key handling. We however want to reset the IM after actual text buffer changes (say, a committed string) moved the cursor position, altered the surrounding text, etc. So that the IM implementation does know to update its state. Since there is going to be an actual IM reset anyways, it does no longer make sense to try to preserve the old priv->need_im_reset status during commit handling. Fixes: 52ac71b972 ("gtktextview: Shuffle the places doing IM reset") Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5133
* gtktextview: Shuffle the places doing IM resetCarlos Garnacho2022-08-181-9/+20
| | | | | | | | | | | | | During text widget manipulation (inserting or deleting text via keyboard) the IM context is reset somewhat early, before the actual change took place. This makes IM lag behind in terms of surrounding text and cursor position. Shuffle these IM reset calls so that they happen after the changes, and ensure that the IM is actually reset, since that is currently toggled on a pretty narrow set of circumstances. Also, fix a bug during GtkEventControllerKey::im-update where the condition on cursor position editability to reset the IM context was inverted.
* textview: Include gutter while computing child allocationsJCWasmx862022-07-131-7/+57
| | | | | | | | | The width of the left gutter and the height of the top gutter are now used while computing the child allocations for e.g. anchors, otherwise - if such a gutter is present - the widget would be at the wrong position. Closes #5016
* Remove all nicks and blurbs from param specsSophie Herold2022-05-111-63/+21
| | | | | | | | Those property features don't seem to be in use anywhere. They are redundant since the docs cover the same information and more. They also created unnecessary translation work. Closes #4904
* Merge branch 'wip/chergert/fix-textview-dnd-move-same-view' into 'main'Matthias Clasen2022-01-071-2/+38
|\ | | | | | | | | textview: remove drag selection after dnd move action See merge request GNOME/gtk!4346
| * textview: remove drag selection after dnd move actionChristian Hergert2022-01-061-2/+38
| | | | | | | | | | | | | | | | | | | | If we have a GDK_ACTION_MOVE, we need to delete the selection. However, previously this only worked when the drop target and drag source were different applications, as the selection would get messed up along the way. Instead, we stash marks for the duration of the operation so that we can delete the appropriate selection when completing the move.
* | textview: scroll insert onscreen after undo/redoChristian Hergert2021-12-261-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | After performing an action such as undo/redo, we need to actually scroll to the position where the operation occurred. I do note that the scroll here seems to often get invalidated if it is pages away, and we never make the full scroll. But I've seen this all over the place elsewhere too and that needs to be handled, most likely, as a more comprehensive fix for scrolling during line validation. Related #4575
* | Merge branch 'textview-im-surrounding' into 'main'Matthias Clasen2021-12-031-0/+12
|\ \ | | | | | | | | | | | | textview: Provide more context to input methods See merge request GNOME/gtk!4209
| * | textview: Provide more context to input methodsMatthias Clasen2021-12-031-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | When returning surrounding context to input methods, include at least 2 words before and after the insertion point. Update the affected input method tests.
* | | textview: Improve scroll-to-mark behaviorMatthias Clasen2021-12-011-6/+6
|/ / | | | | | | | | | | | | | | | | | | The idea of within-margin is to scroll as little as possible to bring the mark within the margins defined by the factor. The code was achieving that when scrolling down, but not when scrolling up. This change makes things symmetrical. Fixes: #4325
* | textview: Avoid misplacing the Emoji chooserMatthias Clasen2021-11-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | When the iter is at the end of the buffer, gtk_text_view_get_iter_location returns a rectangle with width 0, which in turn makes gdk_rectangle_intersect return FALSE. Avoid that by always giving the rectangle non-empty dimensions. Fixes: #4503
* | textview: Respect editability for EmojiMatthias Clasen2021-11-301-4/+4
|/ | | | | | Switch the Emoji chooser keybinding to use the action, so that disabling the action has the desired effect.
* textview: Don't leave embedded children behindMatthias Clasen2021-11-081-0/+11
| | | | | | | | | When scrolling embedded widgets out of view, they sometimes get left behind because we don't reallocated them. To avoid that, move _all_ children out of view in size_allocate, and let the current child allocation plumbing move the visible ones back in place.
* Remove a confusing commentMatthias Clasen2021-11-081-116/+113
| | | | | | It talks about propagating to unanchored children, but then iterates over anchored_children. That does not add up.
* textview: improve undo grouping when overwritingwip/chergert/undo-fixesChristian Hergert2021-09-231-5/+20
| | | | | | | We want to group in more than one undo group when removing a selection and replacing it with a new character or characters, unless we're replacing a single character. In that case, the natural thing is to treat it as an atomic change.
* gtktextview: Fixed arrow key crash.Jordan Yelloz2021-09-211-1/+1
| | | | | | | | | | When pressing the keyboard arrows to move around when the insertion point is hidden, it causes an assertion error in blink_cb. Insertion point blinks should only be scheduled when blinking is enabled and the insertion point is visible. Closes #4275
* textview: Remove a dead storeMatthias Clasen2021-09-171-1/+0
| | | | Pointed out by clang.
* textview: Invalidate Pango contextstext-fixesMatthias Clasen2021-09-041-14/+50
| | | | | | | We need to invalidate the Pango contexts when font settings change. Use the new helper gtk_widget_update_pango_context to make it less likely that we forget to update some things.
* Clean up the codeMatthias Clasen2021-08-261-45/+15
| | | | | Avoid compiler warnings, and make the code a bit more compact.
* textview: Apply font features from cssMatthias Clasen2021-08-261-16/+19
| | | | | | We were forgetting to propagate these values from CSS to the default attributes. Share the code for getting these values out of a GtkCssStyle.
* textview: Apply text transform from csscss-line-decorationMatthias Clasen2021-08-261-0/+24
| | | | | We were forgetting to propagate these values from CSS to the default attributes.
* textview: Apply line decoration from cssMatthias Clasen2021-08-261-0/+81
| | | | | We were forgetting to propagate these values from CSS to the default attributes.
* textview: Don't forget to collect css letterspacingMatthias Clasen2021-08-261-0/+3
| | | | | | | There are more properties missing, this is just the start. Fixes: #4207
* textview: Set line height from cssMatthias Clasen2021-08-221-0/+13
| | | | | | Set the line height in the default attributes from the CSS style. This makes line height work in GtkTextView.
* textview: Improve word selectionMatthias Clasen2021-08-191-2/+0
| | | | | | | Avoid selecting a whole extra paragraph when a select-by-words selection is extended beyond the end of the previous paragraph. Fixes: #4177
* imcontext: Improve docsMatthias Clasen2021-08-171-1/+1
| | | | Add some more docs around GtkIMContext.
* Revert "textview: fix yoffset position when top_margin is set"Christian Hergert2021-08-051-1/+1
| | | | | | This reverts commit 908b1e5e1214afc01440bc07a8d937222f411f38. This commit broke top-margin altogether.
* textview: Fix the get_surrounding implementationMatthias Clasen2021-08-021-1/+1
| | | | This was, sadly, returning garbage.