1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00
sortix--sortix/editor
Juhani Krekelä 7e5a816749 Refactor movement code in editor(1).
Firstly, lots of places in editor(1) would do a move from (x₀,y₀) to
(x,y) by first moving to (x,y₀) or (x₀,y) and only then (x,y). If the
intermediate positions were not valid cursor positions, this might cause
out of bounds access. Categorically fixed this by removing functions for
moving only horizontally or only vertically.

Secondly, editor_select_set() would set the column before setting the
line. Since the code for setting the column accesses the currently set
line at the new cursor position, it might cause out of bounds access
even on valid cursor positions. Fixed this by swapping the order in
which column and row are set.

Thirdly, the order of arguments passed to row_column_smallest() and
row_column_biggest() was wrong, with column being passed before the row,
even though they were defined the other way. However, this did not
result in out of bounds memory accesses due to the parameters to
editor_cursor_set() also being swapped at relevant callsites.

Finally, the boundary condition for control-down was off by one.
2021-12-06 07:50:37 +02:00
..
.gitignore Move editor to its own subdirectory. 2014-12-07 20:29:08 +01:00
command.c Refactor movement code in editor(1). 2021-12-06 07:50:37 +02:00
command.h Port the editor to non-sortix operating systems. 2016-05-15 22:43:29 +02:00
cursor.c Refactor movement code in editor(1). 2021-12-06 07:50:37 +02:00
cursor.h Refactor movement code in editor(1). 2021-12-06 07:50:37 +02:00
display.c Fix indentation in editor/display.c. 2019-04-09 15:11:53 +02:00
display.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
editor.1 Change go to line keybind in editor(1) from ^I to ^G 2021-05-02 22:42:37 +02:00
editor.5 Fix date format in manual pages. 2017-07-02 22:07:39 +02:00
editor.c Port the editor to non-sortix operating systems. 2016-05-15 22:43:29 +02:00
editor.h Port the editor to non-sortix operating systems. 2016-05-15 22:43:29 +02:00
highlight.c Fix indention in editor(1). 2018-03-11 18:10:09 +02:00
highlight.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
input.c Fix Ctrl+Down selecting text instead of moving cursor in editor(1). 2018-03-11 18:39:00 +02:00
input.h Type escape colon to enter commands in editor(1). 2016-11-22 21:36:43 +01:00
Makefile Remove VERSIONSTR define for programs not using it. 2017-03-19 17:34:19 +01:00
modal.c Refactor movement code in editor(1). 2021-12-06 07:50:37 +02:00
modal.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
multibyte.c Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
multibyte.h Relicense Sortix to the ISC license. 2016-03-05 22:21:50 +01:00
terminal.c Port the editor to non-sortix operating systems. 2016-05-15 22:43:29 +02:00
terminal.h Fix indention in editor(1). 2018-03-11 18:10:09 +02:00