Commit Graph

191 Commits

Author SHA1 Message Date
Michael Drake
ff87de87f3 desktop: textarea: Squash -Wcalloc-transposed-args (gcc-14) 2024-05-24 21:09:24 +01:00
Pranjal Kole
4fc78449ff textarea: always clear selection on NS_KEY_WORD_{LEFT,RIGHT}
This bug can be seen by selecting some text starting from the beginning
of a textarea (so that caret is 0) and then pressing the
NS_KEY_WORD_LEFT binding.

NS_KEY_WORD_LEFT was breaking early when caret was 0. So, to always
clear the selection, the clear selection code has been brought above the
break statement.

NS_KEY_WORD_RIGHT did not have such a break statement, so one has been
added for consistency, and because string operations are expensive.
2022-01-23 14:22:40 +00:00
Pranjal Kole
76ede0f7d6 textarea: implement NS_KEY_DELETE_WORD_{LEFT,RIGHT}
NS_KEY_DELETE_WORD_{LEFT,RIGHT} have been added to
include/netsurf/keypress.h and implemented in desktop/textarea.c

An unsigned int, caret_copy, has been added since both of these require
a temporary variable to hold the original position of the caret.

The LEFT one deletes separators towards the left till it encounters a
non-separator and then deletes the non-separators until it encounters a
separator. The caret is moved towards the left by the number of
characters deleted.

The RIGHT one does the same towards the right, but the caret is kept at
its original position.

These are intended to be mapped to Ctrl+Backspace and Ctrl+Delete by
most frontends.

Additionally, some style and typo fixes have been made.
2022-01-22 19:39:26 +00:00
Michael Drake
66493421e6 Plotters: Change stroke width in the plot_style_t to fixed point. 2018-05-23 13:04:19 +01:00
Michael Drake
a58d97a41a Plotters: Add plot_style_fixed type, and use for font size. 2018-05-23 11:48:35 +01:00
Michael Drake
6be6fa1b21 CSS utils: Handle new units in length conversion routines.
This causes a ripple effect of all the callsites needing
information they didn't have.
2018-01-05 13:49:51 +00:00
Michael Drake
2557335f1b Squash GCC7 warning for ‘~’ on a boolean expression. 2017-10-23 09:50:27 +01:00
Michael Drake
2a294adfb1 Textarea: Add API to access current textarea contents. 2017-09-18 23:18:44 +01:00
Vincent Sanders
75018632a9 Use coccinelle to change logging macro calls in c files
for F in $(git ls-files '*.c');do spatch --sp-file foo.cocci --in-place ${F};done

@@ expression E; @@
-LOG(E);
+NSLOG(netsurf, INFO, E);
@@ expression E, E1; @@
-LOG(E, E1);
+NSLOG(netsurf, INFO, E, E1);
@@ expression E, E1, E2; @@
-LOG(E, E1, E2);
+NSLOG(netsurf, INFO, E, E1, E2);
@@ expression E, E1, E2, E3; @@
-LOG(E, E1, E2, E3);
+NSLOG(netsurf, INFO, E, E1, E2, E3);
@@ expression E, E1, E2, E3, E4; @@
-LOG(E, E1, E2, E3, E4);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4);
@@ expression E, E1, E2, E3, E4, E5; @@
-LOG(E, E1, E2, E3, E4, E5);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5);
@@ expression E, E1, E2, E3, E4, E5, E6; @@
-LOG(E, E1, E2, E3, E4, E5, E6);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6);
@@ expression E, E1, E2, E3, E4, E5, E6, E7; @@
-LOG(E, E1, E2, E3, E4, E5, E6, E7);
+NSLOG(netsurf, INFO, E, E1, E2, E3, E4, E5, E6, E7);
2017-09-06 18:45:27 +01:00
Vincent Sanders
44c5aef1c8 make scrollbar redraw signal errors correctly
allow scrollbar redraw to return error codes and update documentation
commenst appropriately.
2017-03-01 23:30:29 +00:00
Vincent Sanders
3722ff8d86 Update all core use of plotters to new API 2017-02-11 13:55:41 +00:00
Vincent Sanders
8066d1c8b4 move key press enums and operations to their own header 2016-07-01 14:27:04 +01:00
Vincent Sanders
8861923455 Allow include directories to be added by sub makefiles 2016-06-06 14:47:27 +01:00
Vincent Sanders
667605869f move plotters header into public API 2016-05-30 21:05:57 +01:00
Vincent Sanders
7fc0a4c481 move desktop window header into public API 2016-05-30 17:32:57 +01:00
Vincent Sanders
8711fbe47d move mouse and pointer state header into public API 2016-05-30 12:10:08 +01:00
Vincent Sanders
9ce71876ce move layout header into public API 2016-05-30 11:31:35 +01:00
Vincent Sanders
d240bec036 move clipboard header into public API 2016-05-30 11:04:32 +01:00
Vincent Sanders
6722943b81 move the CSS content handler 2016-05-26 11:18:41 +01:00
Vincent Sanders
69cea38f41 update scrollbar_create error handling to return nserror 2016-04-26 12:14:56 +01:00
Vincent Sanders
974a4a21e1 split out the layout glyph sizing and splitting API
This refactors the core "font" sizing API to be handled through gui
 function tables similar to every other core/frontend calling API.
2016-04-23 23:32:21 +01:00
Vincent Sanders
c105738fa3 Change LOG() macro to be varadic
This changes the LOG macro to be varadic removing the need for all
callsites to have double bracketing and allows for future improvement
on how we use the logging macros.

The callsites were changed with coccinelle and the changes checked by
hand. Compile tested for several frontends but not all.

A formatting annotation has also been added which allows the compiler
to check the parameters and types passed to the logging.
2015-05-28 16:08:46 +01:00
Witold Filipczyk
befa5e6ed3 To avoid namespace conflicts with ncurses add NetSurf key prefix.
Adds a NetSurf key code prefix of NS_ to all key codes.
2015-03-27 09:36:19 +00:00
Michael Drake
555276b04a Ensure line lengths cache is created initialised to zero. 2015-02-15 13:48:27 +00:00
Vincent Sanders
7c4c73f1b0 Desktop doxygen fixes 2014-11-09 21:49:33 +00:00
Vincent Sanders
1097cc40b4 remove unecessary browser.h include from core headers 2014-10-17 12:21:52 +01:00
Vincent Sanders
d06df231bc Update the core to use the split operations table headers
Second in the series to decouple the core API usage from the frontends.
2014-10-16 22:33:43 +01:00
Vincent Sanders
17be8cf216 Put the font operations table alongside all the other core API
The netsurf core is driven from numerous operation tables most of
which are now set through a common netsurf_register() interface. The
font and plotting interfaces are currently separate and unlike all the
other operation tables are modified for differing contexts.

This change moves the font operations alongside all the other
operations table and remove unnecessary interaction with the renderers
font internals. Further this also removes the need for css internals
to be visible in frontends.
2014-10-13 11:56:31 +01:00
Michael Drake
f58a2580e0 Fix textarea wrap bug.
Was comparing against the current start line length, to decide if it
needed redrawing, without taking into account that old start line
might have been longer.
2014-09-27 18:58:37 +01:00
Michael Drake
f95b9d2eb3 Fix a couple of comment typos. 2014-09-19 11:10:43 +01:00
Michael Drake
1878bc88a9 Improve comments and simplify code. 2014-09-18 16:00:31 +01:00
Michael Drake
dcf49c7341 Improve textarea layout comments to explain the non-obvious bits better. 2014-09-18 16:00:31 +01:00
Michael Drake
2dc8459c84 Improve comment. 2014-09-18 16:00:30 +01:00
Michael Drake
87c5753d49 Fix missing doxygen parameter comment. 2014-09-18 16:00:30 +01:00
Achal-Aggarwal
763825e597 Fixes #2101, evaluation of text field and textarea line height. 2014-03-31 01:53:06 +05:30
Michael Drake
b16cfd2d6e Fix #0002097, with thanks to Achal-Aggarwal for tracking this down. 2014-03-27 21:43:19 +00:00
Michael Drake
143f28572a Fix redraw when selections are deleted. 2014-02-17 12:15:08 +00:00
Michael Drake
aa380ed47a More scaled rendering improvements. Partial redraws of scaled textareas can't work atm, since neither the textarea nor content is aware of scale. 2014-01-21 14:37:46 +00:00
Michael Drake
3f3b64bf22 Fix scaled rendering clip rect bottom calculation. 2014-01-21 11:13:36 +00:00
Vincent Sanders
bd065d4a43 split browser gui operations up 2014-01-15 19:37:05 +00:00
Vincent Sanders
68eaec5cb4 complete move of remaining core gui functions 2014-01-15 12:28:55 +00:00
Vincent Sanders
0075eab194 move remaining gui operations to table 2014-01-14 23:31:54 +00:00
Michael Drake
838359194e Return message to client when textarea is modified. 2014-01-04 14:48:58 +00:00
Michael Drake
640bb77330 Dodge Coverity scan issue. 2013-10-23 11:16:34 +01:00
Michael Drake
0c4f32fb1d Make undo and redo share common implementation. 2013-10-01 18:29:22 +01:00
Michael Drake
5809bcefa6 Wipe undo buffer on textarea_set_text. 2013-10-01 14:03:02 +01:00
Michael Drake
3bdc61a131 Ensure cut can be undone. 2013-10-01 13:54:34 +01:00
Michael Drake
6a4601c3ce Implement textarea undo and redo. 2013-10-01 13:30:20 +01:00
Michael Drake
308a24e661 Start implementing undo/redo. For now it just records changes, the actual undo/redo handling is not yet done. 2013-09-30 21:38:41 +01:00
Michael Drake
b96222d857 We return client data, not node. 2013-09-14 23:22:13 +01:00